System: The following message was cut out of thread at:
http://www.webmasterworld.com/apache/4455792.htm [webmasterworld.com] by incredibill - 8:43 am on May 21, 2012
(PST -8)
Hi guys, I have been using mod-rewrite for a while and the problem I have now is confusing. I am trying to 301 redirect some old urls to their respective new versions, but it does not work right for some reason. Here is the sample of my htaccess file with the rewrites in question:
RewriteRule ^real-estate/mls.html?searchcity=NORTH+BETHANY&(.*)$ /North_Bethany/Homes/ [R=301,L,NC]
RewriteRule ^real-estate/mls.html?searchcity=SOUTH+BETHANY&(.*)$ /South_Bethany/Homes/ [R=301,L,NC]
... for several cities
RewriteRule ^real-estate/mls.html$ /real-estate-search.html [R=301,L]
The last line is a general redirect when there are no search options. However, all the city searches redirect to that general page as though rules for city searches do not get matched.
As per suggestions above I tried using protocol and domain name as follows:
RewriteRule ^real-estate/mls.html?searchcity=NORTH+BETHANY&(.*)$ http://www.example.com/North_Bethany/Homes/ [R=301,L,NC]
but that did not change the outcome - still not redirecting right.
I would greatly appreciate your suggestions, as I have played with it for a while with no luck.