speaker219 Posted July 21, 2007 Share Posted July 21, 2007 Don't know exactly where I should post this. I need to know what I should use to redirect any file with the extension .jpg to redirect to a php with the name of the file requested as a string. For example, if someone went to: http://example.com/pics/test.jpg I want it to redirect to: http://example.com/pics/view.php?img=test.jpg or http://example.com/pics/test2.jpg to redir to: http://example.com/pics/view.php?img=test2.jpg Sorry If this is the wrong forum, don't know where else to put it, or who else to ask. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted July 21, 2007 Share Posted July 21, 2007 I'm not sure... RewriteEngine on RewriteRule ^pics/([A-Za-z0-9]+)\.(JPG|GIF|JPEG|PNG)$ pics/$1\.$2 [L] RewriteRule ^pics/view.php?img\=([A-Za-z0-9]+)\.(JPG|GIF|JPEG|PNG)$ $1\.$2 [L] Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 21, 2007 Share Posted July 21, 2007 Try this, Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)$ view.php?img=$1 Place it on your pics folder. Quote Link to comment Share on other sites More sharing options...
speaker219 Posted July 21, 2007 Author Share Posted July 21, 2007 Neither one of these work. The first one seems to do absolutely nothing, and the second one returns the 'img' variable in the url as "view.php" not the name of the image. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.