简体   繁体   中英

How to ignore apostrophe in url via .htaccess

I am using following rule in my .htaccess

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

So when I access http://local.xyz.com/personal-care-men 's-toiletries/t/12345 url, it gives me.

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

In $_GET but if I remove the single quote from the url I do not get fl-brand param in $_GET which is correct behavior.

How Can I ignore single quotes in the url so that I get only

Array
(
    [category] => 12345
)

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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