raksmart活动促销

分享

写回答

发帖

BLUEHOST的英文,请大侠帮忙看看呗(已解決問題)

 关闭

英文翻译专版 英文翻译专版 2279 人阅读 | 4 人回复

发表于 2011-3-2 10:47:33 | 显示全部楼层 |阅读模式

The main domain on the hosting account uses the public_html directory for all of its Web site files. Addon domains use sub directories inside the public_html directory. In order to also set up your main domain to use a subdirectory on your hosting account you will need to set up a redirect in the .htaccess file in the public_html folder so that the server knows that any request for your main domain will be redirected to a subdirectory on public_html.
To setup the rewrite/redirect, edit the ~/public_html/.htaccess file. Insert the following code block and make modifications as noted in the (#) comments.


# Bluehost.com
# .htaccess main domain to subdirectory 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 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change yourdomain.com to be your main domain again.
# Change 'subdirectory' to be the directory 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 ^(/)?$ subdirectory/index.php [L]

Visitors to your Web site will not be able to tell that your main domain is using a subdirectory, they will still see the Web site address as http://www.yourdomain.com/page.html.

Note: Using this method will set up a 302 redirect. For more information please look at the following links.

Domain name change of address. http://www.google.com/support/webmasters/83106
Moving website address. http://www.google.com/support/webmasters

Note: To set the main domain to a subfolder as a 301 redirect do no use this method. Bluehost suggests following the advice that google provides regarding 301 redirects.


谢谢了

回答|共 4 个

微微百科

发表于 2011-3-2 11:09:18 | 显示全部楼层

回复 1# 的帖子

给你的一个在Bluehost中设置转向的htaccess规则,具体的规则如下:
# Bluehost.com
# .htaccess main domain to subdirectory 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 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change yourdomain.com to be your main domain again.
# Change 'subdirectory' to be the directory 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 ^(/)?$ subdirectory/index.php [L]

将这些规则放在这个目录下~/public_html/.htaccess 即可!

[ 本帖最后由 微微百科 于 2011-3-2 11:10 AM 编辑 ]

评分

参与人数 1金币 +4 收起 理由
kingto + 4 助人为乐

查看全部评分

kingto

发表于 2011-3-2 18:05:34 | 显示全部楼层

感谢帮助
恩 .htaccess用记事本编辑即可

微微百科

发表于 2011-3-2 18:48:35 | 显示全部楼层

回复 3# 的帖子

是可以用记事本编辑,但在Windows下不可以以,htaccess来命名哦!

哥是浮云

发表于 2011-3-3 22:27:52 | 显示全部楼层

回复 1# 的帖子

建议不要此种方法把主域名指向到子目录中,此种方法弊端是网站以后不能伪静态等。网站的目录路径会暴露,
您需要登录后才可以回帖 登录 | 注册

本版积分规则