PhilipK Posted June 19, 2011 Share Posted June 19, 2011 I need to redirect people from going to an old directory to a new one. Here is how I need to change the url. pics/$var --> index.php?id=$var How should I go about this? Quote Link to comment Share on other sites More sharing options...
PhilipK Posted June 20, 2011 Author Share Posted June 20, 2011 I should also note that /pics/ is my photo directory. So I still need to be able to access them when I embed them on my own website. I just want users to be redirected to the page which the picture is located when they try to view it directly. Quote Link to comment Share on other sites More sharing options...
cags Posted June 20, 2011 Share Posted June 20, 2011 An image displayed on a website is a simple http request for the image which the browser displays on your site, so I'm not sure what you mean by your second post. It's also not entirely clear which direction you want the redirect to occur in, but here's an example of the mod_rewrite rule you may need. RewriteRule ^pics/.*$ /index.php?id=$1 Quote Link to comment Share on other sites More sharing options...
PhilipK Posted June 20, 2011 Author Share Posted June 20, 2011 I tried adding your snippet to my .htaccess file but it doesn't seem to work. http://daroom.info/pics/nesengine.jpg Quote Link to comment Share on other sites More sharing options...
cags Posted June 21, 2011 Share Posted June 21, 2011 Define doesn't work. What do you expect to happen? Quote Link to comment Share on other sites More sharing options...
PhilipK Posted June 21, 2011 Author Share Posted June 21, 2011 My goal is to redirect anyone who views a picture directly to that picture within the slide show. So if someone goes directly to... http://daroom.info/pics/nesengine.jpg they goto http://daroom.info/index.php?id=nesengine.jpg 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.