Remove query strings from 301 redirect

apache, http-status-code-301, query-string, redirect

Solution

two options:

redirectMatch 301 ^/about/ http://www.newsite.com/info? 

or:

RewriteEngine on
RewriteRule ^about/(.*) http://www.newsite.com/info? [L,R=301]

question mark at the end seems to be the critical bit. Second one looks a little cleaner (first leaves a question mark at the end of your URL)

Problem

I am struggling to create appropriate 301 redirects for a site that was originally built using query strings. The old URL structure looks like this: ``` http://www.oldsite.com/about/index.cfm?fuseaction=cor_av&artID=5049 ``` I want to redirect the entire subfolder (named 'about') to a new page on the new domain. The new domain's URL looks like this: ``` http://www.newsite.com/info ``` So, I set up a redirect that looks like this: ``` redirectMatch 301 ^/about/ http://www.newsite.com/info ``` It is redirecting just fine, but it's keeping the original URL string attached, so the new URL ends up looking like this in a browser: ``` http://www.newsite.com/info/?fuseaction=cor_av&artID=5049 ``` I'm definitely not enough of an Apache/301 expert ot know how to fix this. I just want to strip off everything from the ? on. Really appreciate any help.

Original source