注意:比如服务器上面有两个网站,第一个网站也有.htaccess文件,第二个网站也有.htaccess文件,而
www.geekso.com打开的是第一个网站,要想让shop.geekso.com打开第二个网站,那么要把下面的代码写在第一个网站的.htaccess文件当中
# 把 subfolder 改为要绑定的目录.
RewriteCond %{REQUEST_URI} !^/subfolder/
# 不要改以下两行.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 把 subfolder 改为要绑定的目录.
RewriteRule ^(.*)$ /subfolder/$1
# 把 yourdomain.com 改为你要绑定的域名
# 把 subfolder 改为要绑定的目录.
# subfolder/ 后面是首页文件index.php, index.html......
下面是我网站的设置参数:
RewriteCond %{HTTP_HOST} ^(shop.)?shop.geekso.com$
RewriteCond %{REQUEST_URI} !^/cctv/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cctv/$1
RewriteCond %{HTTP_HOST} ^(shop.)?shop.geekso.com$
RewriteRule ^(/)?$ cctv/index.php [L]
本文来自:紫外工控网(
http://www.ziwai.net/) 详细出处请参考:
http://bbs.ziwai.net/blog-2-185.html