Mod rewrite RewriteCond%{QUERY_STRING}出现问题,反向引用未在最终URL中显示
我的.htaccess文件中包含以下内容:Mod rewrite RewriteCond%{QUERY_STRING}出现问题,反向引用未在最终URL中显示,mod-rewrite,backreference,query-string,Mod Rewrite,Backreference,Query String,我的.htaccess文件中包含以下内容: RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$ RewriteRule ^index\.php$ http://%{HTTP_HOST}/product/category/35/page_$1? [R=301,L] 但当我输入URL时,它的行为与预期不符: http://example.com/index.php?rout
RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$
RewriteRule ^index\.php$ http://%{HTTP_HOST}/product/category/35/page_$1? [R=301,L]
但当我输入URL时,它的行为与预期不符:
http://example.com/index.php?route=product/category&path=35&page=2
它被重写为:
http://example.com/product/category/35/page_
有人能告诉我我做错了什么吗
谢谢
eb_dev要引用
RewriteCond
指令的子匹配,您需要使用%n
而不是$n
:
RewriteCond %{QUERY_STRING} ^route=product/category&path=35&page=([0-9]+)$
RewriteRule ^index\.php$ /product/category/35/page_%1? [R=301,L]