无法逃脱"?"在网址重写htaccess

时间:2015-06-05 11:58:49

标签: php apache .htaccess mod-rewrite url-rewriting

I have URL as: spa-shop/admin/index?docid=abc,对于此网址,我使用的是htacces Rewrite Rule。 规则如下:

RewriteRule ^((?i)spa-shop)/(admin)/([a-zA-Z\?]*)$             spavendor/index.php?url=spaAdmin/$3 [L]

在此,我期待的输出是:spashop/index.php?url=spaAdmin/index?docid=abc, 但我得到的是URl:spashop/index.php?url=spaAdminShop/index。请告诉我,虽然我正在逃避问题,但问题是什么?在重写规则中。但它似乎没有被逃脱。

2 个答案:

答案 0 :(得分:1)

您需要使用

urlencode($someURl)

这会编码吗?到%3F

答案 1 :(得分:0)

您可以按此规则替换您的规则:

RewriteRule ^(spashop)/admin/([a-zA-Z]+)/?$ $1/index.php?url=spaAdminShop/$2\?%{QUERY_STRING} [L,NC]