使用FastDomain主机的朋友都知道,FastDomain的主域名绑定在DocumentRoot根目录下,也就是 public_html 或者www目录下,其实它们两个是一个目录。
如果您需要建多个站点,那么你就有可能不希望把一大堆的文件都放在根目录下,而是放在一个单独的目录中,例如public_html/affordidc,这样就和单独的Addon Domain一样的,易于管理,要实现这种功能,我们可以通过修改.htaccess实现。请按照以下说明修改,并保存为.htaccess, 上传到public_html 目录下即可。
# Fastdomain.com
# .htaccess main domain to subfolder redirect
# 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.
# 把所有 yourdomain.com 改成你的主域名
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
# Change ‘subfolder’ to be the folder you will use for your main domain.
# 把所有subfolder 改成你需要绑定的目录,然后上传网站到这个目录即可
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.
# 把所有subfolder 改成你需要绑定的目录
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.
# 把所有 yourdomain.com 改成你的主域名
# 把所有subfolder 改成你需要绑定的目录
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subfolder/index.php [L]