zhangjih 发表于 2010 年 10 月 2 日 11:02:07

BlueHost主域名绑定目录重写

『特别提示:以下内容由金光新闻采集从互联网自动获取』
在虚拟主机中,主域名是使用public_html目录/文件夹作为主域名的缺省目录,主域名网站的文件和程序都是放在public_html目录下,附加的域名(addon domains)使用public_html目录/文件夹下的子目录/子文件夹。有的人可能觉得public_html目录/文件夹下的会看起来比较乱,所以想把主域名也指向其中一个子目录/文件夹。这样就需要利用.htaccess的重写功能。
用.htaccess重写:
代码:
# 开始重写主域名
RewriteEngine on
# 设置重写条件
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 设置重写规则
RewriteRule ^(.*)$ /aaaaa/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ aaaaa/index.php
说明:将yourmaindomain.com,更换为你的主域名,将aaaaa更换为主域名要指向的目录。
页: [1]
查看完整版本: BlueHost主域名绑定目录重写