主机论坛_虚拟主机_美国主机_美国虚拟主机_云主机技术_全球主机交流聚集地—Web Hosting Talk 中文站

找回密码
立即注册
发新帖

0

收听

4

听众

49

主题
发表于 2015-1-4 15:13:16 | 查看: 872| 回复: 0
bluehost在默认情况下,主域名和附加域目录路径如下:

/home/youraccount/public_html/ (主域名对应目录)
/home/youraccount/public_html/subfolderB (附加域名B)
/home/youraccount/public_html/subfolderC (附加域名C)

从上面的路径结构可以看出:主域名所对应的目录/public_html中包含有“附加域名B”和“附加域名C”这两个文件夹,如果你希望让上述三者成为并列关系,可以使用.htaccess命令来灵活定制。

例如实现这种目录结构:

/home/youraccount/public_html/subfolderA (主域名对应目录)
/home/youraccount/public_html/subfolderB (附加域名B对应目录)
/home/youraccount/public_html/subfolderC (附加域名C对应目录)
用文本编辑器编辑.htaccess文件,内容修改和参照下面的代码:

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


收藏回复 显示全部楼层 道具 举报

您需要登录后才可以回帖 登录 | 立即注册

Archiver|手机版|小黑屋|WebHostingTalk中文站

GMT+8, 2024-5-18 23:11 , Processed in 0.077924 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表