Mobile app version of vmapp.org
Login or Join
Phylliss660

: How to redirect requests to another folder using .htaccess? How to redirect requests to another folder using .htaccess? I have my root directory and my website looks into that directory. I want

@Phylliss660

Posted in: #Htaccess #Redirects

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Phylliss660

1 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

Try this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) www.example.com/ [R=301,L]
RewriteRule ^$ subdirectory [L]


If you want an external redirect, set the R flag there as well:

RewriteRule ^$ /subdirectory [L,R=301]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme