Bluehost 主域绑定到任意目录

作者: ldsea 分类: 程序生活 发布时间: 2012-06-07 11:23

 

发现自己的blog在public_html文件下的文件越来越多,而Bluehost所有后添加的域名绑定的目录都在这个文件下,所以这个目录变得越来越乱,这个问题终于在我晕头转向找不到需要的文件的时候得到了我的高度关注^_^,在晚上找到了解决办法,在这里分享给同样使用Bluehost的朋友。

修改 .htaccess 代码如下:

 

.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

# 修改yourdomain.com为你的主域.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$

# 修改 ’subfolder’为你希望主域绑定到的目录的名字.

RewriteCond %{REQUEST_URI} !^/subfolder/

# Don’t change this line.

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# 修改 ’subfolder’为你希望主域绑定到的目录的名字.

RewriteRule ^(.*)$ /subfolder/$1

# 修改yourdomain.com为你的主域. 
# 修改 ’subfolder’为你希望主域绑定到的目录的名字. 
# 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]

发表回复

您的电子邮箱地址不会被公开。