[英]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.