本文介绍了RewriteCond%{QUERY_STRING}出现问题,反向引用未在最终到达的网址中支付的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.htaccess文件中包含以下内容:
I have the following in my .htaccess file:
RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$ RewriteRule ^index\.php$ %{HTTP_HOST}/product/category/35/page_$1? [R=301,L]当我输入URL时,它的表现却不符合预期:
It's not behaving as expected though, when I enter the URL:
example/index.php?route=product/category&path=35&page=2它被重写为:
example/product/category/35/page_有人可以告诉我我做错了什么吗?
Could someone tell me what I have done wrong please?
谢谢
eb_dev
推荐答案要引用RewriteCond指令的子匹配项,您需要使用%n而不是$n:
To reference submatches of a RewriteCond directive, you need to use %n instead of $n:
RewriteCond %{QUERY_STRING} ^route=product/category&path=35&page=([0-9]+)$ RewriteRule ^index\.php$ /product/category/35/page_%1? [R=301,L]更多推荐
RewriteCond%{QUERY
发布评论