RewriteCond%{QUERY

编程入门 行业动态 更新时间:2024-10-18 01:26:58
本文介绍了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

本文发布于:2023-11-01 12:57:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549394.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:RewriteCond   QUERY

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!