Mobile app version of vmapp.org
Login or Join
Radia820

: 301 Redirect are these URLs equivalent? 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/

@Radia820

Posted in: #301Redirect #ModRewrite

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/ www.example.biz/

It redirects to:
www.example.biz/inspection11.htm?q=dup_folder/inspection11.htm

But I want it to redirect to:
www.example.biz/inspection11.htm

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Radia820

1 Comments

Sorted by latest first Latest Oldest Best

 

@Speyer207

Something else is at play here, that is causing
www.example.biz/dup_folder/inspection11.htm

to be converted to
www.example.biz/inspection11.htm?q=dup_folder/inspection11.htm

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme