How to point primary domain to a sub-folder?

Place the code in your .htaccess file. Change 'yourmaindomain.com' to your domain name and subfolder to sub-directory you want to point your main domain to.

  # .htaccess main domain to subfolder redirect

   RewriteEngine on

  # Change yourdomain.com to be your main domain.
  RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$

  # Change 'subfolder' to be the folder you will use for your main domain.
  RewriteCond %{REQUEST_URI} !^/subfolder/

  # Don't change this line.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # Change 'subfolder' to be the folder you will use for your main domain.
  RewriteRule ^(.*)$ /subfolder/$1

  # Change yourdomain.com to be your main domain again.
  # Change 'subfolder' to be the folder you will use for your main domain
  # followed by / then the main file for your site, index.php, index.html, etc.
  RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
  RewriteRule ^(/)?$ subfolder/index.php [L]

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Clearing Your DNS Cache?

Windows® XP, 2000, Vista® or Windows 7 1. Open the Start menu. 2. Go to Run. If you do...

How to setup email account on Apple iPad?

To setup your email account on your Apple iPad. Please follow the following steps: 1. Tap on...

Can my database's be backed up automatically?

Yes, please see below for more information: 1 - Log into your control panel (cPanel) 2 –...

Enable PHP 5.3 support

Our servers support both PHP 5.2 and PHP 5.3. The default version is PHP 5.2.x but you can...

Upload your web site using Microsoft Publisher 2003

To upload your web site using Publisher 2003 simply follow these steps. It should be noted that...