troubleshooting Question

Redirect url with query string

Avatar of fionafenton
fionafentonFlag for United Kingdom of Great Britain and Northern Ireland asked on
Apache Web ServerWordPress
8 Comments1 Solution136 ViewsLast Modified:
Moving a site to Wordpress and have a specific old url that I want to redirect to new page with 301

The old page that I want to redirect is
www.mydomain.co./property/region/Brittany/type.php?ss=Brittany&tt=Gites%20Complex&var1=mls&var=type
And I want it to redirect to
www.mydomain.com/property/search/Cotes-dArmor_Finistere_Ille-et-Vilaine_Morbihan/p/p/b/Gites-Complex/l/a/

I think because of some rewrite rules I have added, the old page isn't currently producing a 404
It's redirecting to
www.mydomain/property/region/Brittany/type.php/?ss=Brittany&tt=Gites%20Complex&var1=mls&var=type
The difference is the forward slash after type.php

I'm pretty sure it's some existing rewrite rules I've set up that are causing this. These are
add_rewrite_rule( 'property/region/([^/]+)/([^/]+)/?', 'index.php?&page_id=69695&mls=$matches[1]&pageno=$matches[2]', 'top');
add_rewrite_rule( 'property/region/([^/]+)/?', 'index.php?&page_id=69695&mls=$matches[1]', 'top');

I don't seem to be able to overwrite these rules for this specific url

I've tried
add_rewrite_rule( 'property/region/Brittany/type.php?ss=Brittany&tt=Gites%20Complex&var1=mls&var=type?', 'index.php?&page_id=70318&mls=Cotes-dArmor_Finistere_Ille-et-Vilaine_Morbihan&minp=p&maxp=p&beds=b&type=Gites-Complex&minl=l&area=a', 'top');

I've also tried adding this to top of .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^ss=Brittany&tt=Gites%20Complex&var1=mls&var=type$ [NC]
RewriteRule ^/property/region/Brittany/type.php$ http://www.mydomain.com/property/search/Cotes-dArmor_Finistere_Ille-et-Vilaine_Morbihan/p/p/b/Gites-Complex/l/a/? [R=301,L]
</IfModule>

I'm sure it's something very minor that I've got wrong, but I just can't spot it.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros