本文介绍了子域重写的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的这些规则,一切工作好。
I have these rules, everything work good.
我只需要添加此规则:
从it.domain/index.php?city=newyork到it.domain/product-usa-newyork~~V
from it.domain/index.php?city=newyork to it.domain/product-usa-newyork
唯一的变化是纽约。它也可以:lasvegas等。
The only thing that change is "newyork". It can be also: lasvegas etc..
推荐答案试试你现有的规则之前插入这条规则的
Try inserting these 2 rules before your existing rules:
#Rewrite from it.domain/index.php?city=dc to it.domain/product-usa-dc RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^[^.]+\.domain\$ [NC] RewriteCond %{THE_REQUEST} \s/+index\.php\?city=([^\s&]+) [NC] RewriteRule ^ /product-usa-%1? [R=302,L] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^[^.]+\.domain\$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^product-usa-([^/]+)/?$ /index.php?city=$1 [L,QSA,NC]更多推荐
子域重写的.htaccess
发布评论