.htaccess中设立 RewriteCond %{HTTP_HOST} 不起作用
程序员文章站
2022-04-06 10:52:23
...
.htaccess中设置 RewriteCond %{HTTP_HOST} 不起作用
RewriteEngine on
RewriteCond %{HTTP_HOST} ^aaa$ [NC]
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$2&page=$3
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4
RewriteCond %{HTTP_HOST} ^bbb$ [NC]
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=lists&catid=$2&page=$3
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=show&catid=$2&id=$3&page=$4
========================================
bbb是个手机站,地址跟aaa是不一样的
这样设置之后,访问bbb还是使用aaa的规则,RewriteCond %{HTTP_HOST}没起作用呀,麻烦帮俺看看,谢谢。
------解决思路----------------------
RewriteEngine on
RewriteCond %{HTTP_HOST} ^aaa$
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$2&page=$3 [NC]
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4 [NC]
RewriteCond %{HTTP_HOST} ^bbb$
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=lists&catid=$2&page=$3 [NC]
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=show&catid=$2&id=$3&page=$4 [NC]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^aaa$ [NC]
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$2&page=$3
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4
RewriteCond %{HTTP_HOST} ^bbb$ [NC]
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=lists&catid=$2&page=$3
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=show&catid=$2&id=$3&page=$4
========================================
bbb是个手机站,地址跟aaa是不一样的
这样设置之后,访问bbb还是使用aaa的规则,RewriteCond %{HTTP_HOST}没起作用呀,麻烦帮俺看看,谢谢。
------解决思路----------------------
RewriteEngine on
RewriteCond %{HTTP_HOST} ^aaa$
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$2&page=$3 [NC]
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4 [NC]
RewriteCond %{HTTP_HOST} ^bbb$
RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=lists&catid=$2&page=$3 [NC]
RewriteRule ^([a-zA-Z]+/)+show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=wap&c=index&a=show&catid=$2&id=$3&page=$4 [NC]
相关文章
相关视频