繁体   English   中英

如何通过.htaccess忽略网址中的撇号

[英]How to ignore apostrophe in url via .htaccess

我在我的.htaccess中使用以下规则

RewriteRule ^([\w-]*)/(.*)/t/(([\d]|[\-])+)$ pronew/ci/touch.php/touch/TouchSearchController?fl-brand=$2&category=$3 [L,QSA]

因此,当我访问http://local.xyz.com/personal-care-men's-toiletries / t / 12345网址时,它给了我。

Array
(
    [fl-brand] => ci/index.php/personal-care-men's-toiletries
    [category] => 12345
)

在$ _GET中,但是如果我从网址中删除单引号,则不会在$ _GET中获得fl-brand参数,这是正确的行为。

如何忽略网址中的单引号,以便仅获得

Array
(
    [category] => 12345
)

您可以在第一部分使用基于否定的正则表达式,在最后一部分使用\\d+

RewriteRule ^([^/]+)/t/([0-9]+)/?$ pronew/ci/touch.php/touch/TouchSearchController?fl-brand=$1&category=$2 [L,QSA]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM