Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to redirect an entire duplicate directory to the same files in the directory above the dup_folder.

Redirect Code in .htaccess:

Redirect 301 /dup_folder/ http://www.example.biz/

It redirects to:


But I want it to redirect to:


Is there something I can add to .htaccess to Rewrite the URL to how I want, or are the two above URLs seen as the exact same URL to a search engine?

share|improve this question
I think this URL has the answer: webmasters.stackexchange.com/questions/7539/… . I have mod_rewrite enabled. Any help with the regular expression is appreciated. – JMC May 3 '11 at 18:03
up vote 1 down vote accepted

Something else is at play here, that is causing


to be converted to


because out of the box, the use of Redirect 301 should not add that query string.

So I'd look at the configuration of your site, the httpd.conf or the configuration of the relevant apache Vhost directive, or indeed existing .htaccess files, to see if you can stop whatever custom redirect process is adding the query string there.

If you can't (find or change), then the following rewrite rule in a .htaccess file under /dup_folder/ (assuming you remove the existing Redirect 301 ) should remove the query string.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/dup_folder/(.*)
RewriteRule .* /inspection11.htm? [R=301,L]

With the use of a trailing ? on the rewrite, it will clear off the query string that is being added by something else.

share|improve this answer
It's been a while since I was messing with this. I'll look back into it tomorrow. The site that had this issue uses a CMS that performs it's own re-writes. Thanks for posting. – JMC Jun 1 '11 at 3:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.