? Redirect with retained information ?

New to mod_rewrite? This is a good place to start.

? Redirect with retained information ?

Postby NickThomas » Tue Aug 18, 2009 4:15 pm

Seeking your expertise...

I have a current directory path:
www.mysite.com/blah/page.php?specialcode=123456

I want to redirect all attempts to blah/ to www.mysite.com/new/index.php?page=new-p ... ode=123456 and want to retain the special code included in the initial URL.

I've essentially re-written a complete section of the site in a mini-MVC model and need to convert traffic going to the old pages to the new model. I can do this in PHP, but want to completely get rid of blah/ and never look at it again.

Any help would be appreciated.

Thanks,
Nick
NickThomas
 
Posts: 1
Joined: Tue Aug 18, 2009 4:11 pm

Postby richardk » Tue Aug 18, 2009 4:22 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^blah/page\.php$ /new/index.php?page=new-page [QSA,R=301,L]

(With QSA to attach the original query string which would otherwise be removed by the new query string.)
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 23 guests

cron