Forum Moderators: phranque
RewriteEngine on
RewriteRule ^oldstuff.php$ http://www.widgets.com/ [R=301,L]
This almost works as expected. Except:
When user goes to old page [widgets.com...]
he gets redirected to
[widgets.com...]
I don't want that to happen. How can I prevent it?
Also, this doesn't seem to work either:
RewriteEngine on
RewriteRule ^oldstuff.php?q=(.*)$ http://www.widgets.com/query/$1 [R=301,L]
Isn't it possible for the RewriteRule to match on parameters?
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^oldstuff.php$ http://www.widgets.com/ [R=301,L]
Second problem NOT solved (but I think I'm close):
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^oldstuff.php$ http://www.widgets.com/query/%1 [R=301,L]
[widgets.com...]
redirects to:
[widgets.com...]
but should be:
[widgets.com...]
What am I doing wrong? Why does the query string get appended to the result?
When you want to erase an existing query string, end the substitution string with just the question mark.
Jim