longtone Posted January 17, 2010 Share Posted January 17, 2010 I want to redirect all pages a directory to one page outside that directory eg: /folder/somepage.php to /anotherpage.php and ideally add a query string: /folder/somepage.php to /anotherpage.php?sv=somepage I thought this would do it: Redirect /folder/([a-zA-Z0-9]+)$ http://www.example.com/anotherpage.php?sv=$1 but it doesn't... Can anyone see what I'm doing wrong? Link to comment https://forums.phpfreaks.com/topic/188735-how-to-redirect-entire-directory-to-one-page/ Share on other sites More sharing options...
trq Posted January 17, 2010 Share Posted January 17, 2010 You won't to use mod_rewrite, not a redirect. RewriteRule /folder/([a-zA-Z0-9]+)$ /anotherpage.php?sv=$1 Link to comment https://forums.phpfreaks.com/topic/188735-how-to-redirect-entire-directory-to-one-page/#findComment-996340 Share on other sites More sharing options...
longtone Posted January 17, 2010 Author Share Posted January 17, 2010 You're right, I was confusing the two Actually what I ended up doing was both: Redirect /folder/ http://www.example/anotherpage/ RewriteRule ^anotherpage/([a-zA-Z0-9]+)?$ anotherpage.php?sv=$1 which gives the new url in the address bar but without the query string Thanks Link to comment https://forums.phpfreaks.com/topic/188735-how-to-redirect-entire-directory-to-one-page/#findComment-996672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.