I am trying to fix a problem where Google has indexed the wrong version of a
URL. I need to redirect the bad version to the good version with 301
redirects.
I've tried a couple of things, but it's not working.
The bad URLs look like this:
/search.php?mode =search&narrow_ cat=2&term=Worl d,%20Hello&page =1
That should redirect to:
/dir/Hello_World
This one doesn't work at all:
RewriteRule
^search\.php\?m ode=search&narr ow_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
http://www.example.com/dir/$2_$1 [R=301,NC,L]
This one works, except it doesn't include the "Hello" and the "World", only
the underscore:
RewriteCond %{QUERY_STRING}
mode=search&nar row_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
RewriteRule ^search\.php http://www.example.com/dir/$2_$1 [R=301,NC,L]
Any ideas?
URL. I need to redirect the bad version to the good version with 301
redirects.
I've tried a couple of things, but it's not working.
The bad URLs look like this:
/search.php?mode =search&narrow_ cat=2&term=Worl d,%20Hello&page =1
That should redirect to:
/dir/Hello_World
This one doesn't work at all:
RewriteRule
^search\.php\?m ode=search&narr ow_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
http://www.example.com/dir/$2_$1 [R=301,NC,L]
This one works, except it doesn't include the "Hello" and the "World", only
the underscore:
RewriteCond %{QUERY_STRING}
mode=search&nar row_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
RewriteRule ^search\.php http://www.example.com/dir/$2_$1 [R=301,NC,L]
Any ideas?
Comment