htaccess to display subfolder as the domain name

inside the public_html directory, we want to use the subfolder for example named 'mysubfolder' but in the url shown as http://www.mydomain.com or http://mydomain.com instead of http://www.mydomain.com/mysubfolder.

Below is the .htaccess code to be put in the public_html directory.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteCond %{REQUEST_URI} !^/mysubfolder/
RewriteRule ^(.*)$ mysubfolder/$1 [L]


0 comments:

Post a Comment