我有这个重写规则!
RewriteEngine On
RewriteRule ^cat/([^/]*)/([^/]*)\.php$ /shop.php?cat=$1&catn=$2 [L]
,链接
http://www.logromania.xyz/shop.php?cat=81&catn=Shard%20Pantofi%20lux%20Dama%20Femei%20Pantofi%20piele%20Dama%20comozi%20Pantofi%20Italia%20dama%20pret%20ieftin%20pantofi%20casual%20dama%20Bucuresti%20Tirgu%20Jiu%20Brasov%20craiova%20Timisoara%20Iasi%20Constanta%20Deva%20bacau%20Buzau%20galati%20Braila%20Oradea
应该是
http://www.logromania.xyz/cat/81/Shard%20Pantofi%20lux%20Dama%20Femei%20Pantofi%20piele%20Dama%20comozi%20Pantofi%20Italia%20dama%20pret%20ieftin%20pantofi%20casual%20dama%20Bucuresti%20Tirgu%20Jiu%20Brasov%20craiova%20Timisoara%20Iasi%20Constanta%20Deva%20bacau%20Buzau%20galati%20Braila%20Oradea.php
但是不行!是问题还是问题?谢谢!
答案 0 :(得分:1)
这需要更复杂的.htaccess。
RewriteCond %{QUERY_STRING} cat=([0-9]+)
RewriteCond %{QUERY_STRING} catn=([^&]+)
RewriteRule ^/?shop.php$ /cat/%1/%2? [R=301,L]
有关其工作原理的详细说明,请访问http://www.sitepoint.com/apache-mod_rewrite-examples-2/
看看例子10和11。
要测试您的RewriteRules,您可以使用此在线测试工具:http://htaccess.madewithlove.be/
答案 1 :(得分:0)
试试这个
RewriteEngine On RewriteRule ^cat/([0-9]+)/(.*).php$ /shop?cat=$1&catn=$2