How to redirect requests to another folder using .htaccess?
I have my root directory and my website looks into that directory. I want it to look in the /subdirectory/
instead. I can't modify the server config.
Webmasters Stack Exchange is a question and answer site for webmasters. It only takes a minute to sign up.
Sign up to join this communityTry this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^$ subdirectory [L]
If you want an external redirect, set the R
flag there as well:
RewriteRule ^$ /subdirectory [L,R=301]
subdirectory
from URL?