Redirect One Directory To Another With .htaccess
Mon, 05/19/2008 - 08:55 | by philipnorton42
To stop access to a directory (and anything in that directory) all you need is a simple RewriteRule.
RewriteEngine on RewriteBase / RewriteRule ^exampledirectory/(.*)$ / [R=301,L]
In this example, if this .htaccess file resides in the root directory of the site and you try to access anything within /exampledirectory you will be redirected back to the root folder. To redirect to another folder (like anotherdirectory) on your web server use the following rule.
RewriteEngine on RewriteBase / RewriteRule ^exampledirectory/(.*)$ /anotherdirectory [R=301,L]
Comments
This helped me a lot.
Post new comment