How to change root directory of primary domain with .htaccess file?

kumkumsharma

Administrator
Staff member
If your website’s files are available in sub folder but you want to access the files directly with domain name then you can redirect your domain with the help of .htaccess file.

You can add below code in .htaccess file:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
NOTE: You have to enter your domain name instead of yourdomain.com and enter your subfolder name instead of folder.
 
Top