Bluehost绑定主域名到任意目录

Bluehost的控制管理真是相当麻烦就拿域名与ftp目录对应的关系来说,都够头疼的,而且主域名也就是购买时候的域名竟然是/public_html/ 这个目录,也就是他是所有后添加网站的目录的上一层目录. 很显然,如果这个样的话 这个主域名怎么用啊,这样的话,子目录下的那些站点都成为主域名的副站点了.想象bluehsot控制面板管理真是人性化,结果寻找终于找到怎么绑定任意目录的方法了.是修改.htaccess,规则如下:

# Bluehost.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.

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]

备注:subfolder替换你在public_html/下建立的目录,yourmaindomain.com替换为你的域名

 
  • 本文由 米粒在线 发表于 2012年9月1日15:03:56
  • 转载请务必保留本文链接:https://www.miliol.org/195.html

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证