Return to Snippet

Revision: 70466
at February 26, 2016 06:32 by apphp-snippets


Initial Code
# Redirect visitors to another directory
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)$ /sub_dir/index.html [NC,L,QSA]

Initial URL
http://www.apphp.com/index.php?snippet=htaccess-redirect-to-another-directory

Initial Description
This example shows you how to create redirection o another directory. It may be useful, for example, when you have a project, placed in sub-directory.

Initial Title
Redirect to Another Directory in .htaccess

Initial Tags
redirect, htaccess, directory

Initial Language
PHP