Link to home
Start Free TrialLog in
Avatar of Heather Ritchey
Heather RitcheyFlag for United States of America

asked on

htaccess redirect with query string to specific page

How to I correctly redirect individual urls that have a query string at the end to a specific url that does not contain any queries? There will be many to do, but several pages have different query strings on them, but now go to individual pages. Here's one of the redirects that I need to make work: (I tried that normal redirect in the htaccess but it just goes to a 404 error page)

redirect 301 /Neighborhood.aspx?NeighborhoodId=6399 http://herrickguestsuites.com/suites/chelsea/
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Heather Ritchey

ASKER

Had to add the upward arrows for it to work:
RewriteCond %{QUERY_STRING} ^NeighborhoodId=6399$ [NC]
RewriteRule ^Neighborhood\.aspx$ http://herrickguestsuites.com/suites/chelsea/? [R=301,L]

Open in new window

Just in case it's helpful to someone else:
This was on bluehost and that redirect code had to go before the wordpress permalink structure code (but of course after the RewriteEngine On RewriteBase / lines).