Avatar of Heather Ritchey
Heather Ritchey
Flag 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/
Apache Web ServerWordPressWeb Development

Avatar of undefined
Last Comment
Heather Ritchey

8/22/2022 - Mon
Steve Bink

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Heather Ritchey

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

Heather Ritchey

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).
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck