Redirect main domain to subdirectory

Question

Following the following code sample I managed to redirect it, however the site URL on the browser show as domain.com/subdirectory and not domain.com.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdirectory/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]
0
stemon 2 months 0 Answers 12 views 0

Leave an answer