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替換為你的域名
評論