I have two php mainly - share.php and gen.php
SHARE.PHP http://example.com/share.php?name=52afcb2793007
while
GEN.PHP http://example.com/gen.php?name=images/This%20is%20%20%20example.jpg
I am new to writing .htaccess and have been reading on stackoverflow and finding pretty url makers for .htaccess. So far I can either run share.php or gen.php My current .htaccess looks like this
ErrorDocument 404 /404.html
RewriteEngine on
RewriteRule ^new/?$ new.php [NC]
RewriteRule ^webcam/?$ webcam.php [NC]
RewriteRule ^([a-zA-Z0-9]+)$ share.php?name=$1
RewriteRule ^([a-zA-Z0-9]+)/$ share.php?name=$1
RewriteRule ^([a-zA-Z0-9]+)$ gen.php?name=images/$1
RewriteRule ^([a-zA-Z0-9]+)/$ gen.php?name=images/$1
It gives a 500 server error when I give a url like http://example.com/someimage.jpg which I guess is because its trying to access share.php and getting the error.
The output I am looking to get is something like this http://example.com/gen/Image.jpg (where Images will be hyphened instead of %20 - been reading on that as well) http://example.com/some_id (goes to share.php) - this works which I am guessing is the rule that .htaccess sees first and matches and the id exists so gives the result.
/blahmatches both of them, thus the first rule gets executed first, always, no matter what. That shouldn't be causing the 500 server error though unless your php script is returning that./gen/(something), and your URLs will look like what you've linked:http://example.com/gen/Image.jpg, then "Image.jpg" gets passed into gen.php asname=images/Image.jpg