: Use .htaccess to rewrite requests for a PNG as a PHP GET variable I'm REALLY bad with .htaccess files, and reading through the existing questions on SO only confuse me more (mainly because
I'm REALLY bad with .htaccess files, and reading through the existing questions on SO only confuse me more (mainly because they're all situation-specific and don't exactly apply to my situation at hand). I'm making a script that generates dynamic images through PHP. The script takes 1 variable, which makes the URL look like this:
www.example.com/script/image.php?name=esqew
However, I'd like to utilize an .htaccess file to rewrite the file to something more elegant and something my users can use on forums, like so:
www.example.com/script/esqew.png
The question, in a nutshell, is how do I rewrite the first request above to something more elegant like the second example using .htaccess?
More posts by @Moriarity557
1 Comments
Sorted by latest first Latest Oldest Best
Use this code in .htaccess file:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^(script)/([^.]*).png$ /image.php?name= [L,NC]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.