Loading your main website from a subdirectory

By placing the following code in your .htaccess file  in your main public_html you can load your main site from a subdirectory:

RewriteEngine on
# Edit example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Edit 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change these line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Edit 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Edit example.com to be your main domain again.
# Edit 'subdirectory' to be the directory you will use for the main domain.
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]

You will need to edit the entries as shown in the comments above.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is a alias Domain?

A Alias domain allows you to host another domain on your account, however this domain can only...

What is an addon domain?

On our shared (non-reseller) web hosting plans addon domains allow multiple domain hosting on...

Where to upload your files

All files that you want to appear on your website should be uploaded to within your public_html...

Taking a Traceroute (tracert) in Windows

To take a traceroute (in windows this is done by the application called tracert) you need to open...

Is mod_rewrite enabled?

Yes all of our servers come with Apache’s mod_rewrite module. You can use it via the .htaccess...