Redirect to Another Directory in .htaccess


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. # Redirect visitors to another directory
  2. RewriteEngine on
  3. RewriteCond %{REQUEST_FILENAME} !-f
  4. RewriteCond %{REQUEST_FILENAME} !-d
  5. RewriteRule ^([^?]*)$ /sub_dir/index.html [NC,L,QSA]

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.