How do I make a subfolder the main folder for my main domain?

The main domain on the hosting account uses the public_html folder for all of its website files. In order to also set up your main domain to use a subfolder on your hosting account you will need to set up a redirect in the .htaccess file in the public_html folder so that the server knows that any request for your main domain will be redirected to a subfolder on public_html.

Visitors to your website will not be able to tell that your main domain is using a subfolder, they will still see the website address as http://www.yourdomain.com/page.html

# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

# Do not change this line -
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 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

How do I create a redirect for my site?

The redirect option is available in your control panel. Please login into your control pane and...

How do I activate SSL in osCommerce?

In order to configure osCommerce to work with SSL please open the file...

CAPTCHA: Telling Humans and Computers Apart Automatically

A CAPTCHA is a program that protects websites against bots by generating and grading tests that...

How do I reset my password for osCommerce?

osCommerce uses .htaccess and .htpasswd format files to manage the protection on the admin...

How to Stop A Directory Index From Being Shown

Sometimes, for one reason or another, you will have no index file in your directory. This will,...