I can’t seem to find a solution that works for my particular situation, despite many others having similar issues. When I try to create a 301 redirect for a URL that has already been rewritten, the redirect works, but appends a query string to the end of the target URL, which references the URL to be redirected. For example:
Redirect 301 /dir1/dir2/dir3/ http://www.example.com/dir1/dir2/dir5/
results in
http://www.example.com/dir1/dir2/dir5/?&a=/dir1/dir2/dir3/
I don’t believe the
Redirectrule above is appending the QS params, so it is likely another rule in your .htaccess.You also need to verify when the additional QS params are being added, before the first redirect or in a subsequent redirect. You can to this using an HTTP debugging proxy e.g. Fiddler
Alternatively, you can use the place the equivalent rule below at the top of your .htaccess, before any other rules and see if the extraneous QS params are still there.
If they are still present, something else in your .htaccess is matching
http://www.example.com/dir1/dir2/dir5/and adding the QS valuePosting the relevant portions of your .htaccess, or the entire thing if you can would help