举例:
有多个域名:site1.abc.com
,site2.abc.com
,site3.abc.com
分别在二级目录site1.abc.com/
,site2.abc.com/
,site3.abc.com/
.htaccess的代码如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24RewriteEngine On
RewriteCond %{HTTP_HOST} ^site1.abc.com$
RewriteCond %{REQUEST_URI} !^/site1.abc.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1.abc.com/$1
RewriteCond %{HTTP_HOST} ^site1.abc.com$
RewriteRule ^(/)?$ site1.abc.com/index.php [L]
RewriteCond %{HTTP_HOST} ^site2.abc.com$
RewriteCond %{REQUEST_URI} !^/site2.abc.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site2.abc.com/$1
RewriteCond %{HTTP_HOST} ^site2.abc.com$
RewriteRule ^(/)?$ site2.abc.com/index.php [L]
RewriteCond %{HTTP_HOST} ^site3.abc.com$
RewriteCond %{REQUEST_URI} !^/site3.abc.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site3.abc.com/$1
RewriteCond %{HTTP_HOST} ^site3.abc.com$
RewriteRule ^(/)?$ site3.abc.com/index.php [L]
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/9987.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~