|
发表于 2015-1-4 15:13:16
|
查看: 872 |
回复: 0
bluehost在默认情况下,主域名和附加域目录路径如下:
/home/youraccount/public_html/ (主域名对应目录)
/home/youraccount/public_html/subfolderB (附加域名B)
/home/youraccount/public_html/subfolderC (附加域名C)
从上面的路径结构可以看出:主域名所对应的目录/public_html中包含有“附加域名B”和“附加域名C”这两个文件夹,如果你希望让上述三者成为并列关系,可以使用.htaccess命令来灵活定制。
例如实现这种目录结构:
/home/youraccount/public_html/subfolderA (主域名对应目录)
/home/youraccount/public_html/subfolderB (附加域名B对应目录)
/home/youraccount/public_html/subfolderC (附加域名C对应目录)
用文本编辑器编辑.htaccess文件,内容修改和参照下面的代码:
# .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.
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]
|
|