开发者

.htaccess rule not catching

I'm trying to catch http://mysite.loc/orders/invoice/?id=asdf and redirect it, but it's not catching. Does anyone have any ideas on something I might've missed?

Rewrit开发者_Python百科eEngine On

RewriteRule ^orders/invoice?id=([^/]+)$ /store/order/view?hash=$1 [R=301,L,NC]


Rewrite rules act on request URIs. The query string (the question mark and everything after it) is not part of the URI so you can't write a pattern to match it.

Try this:

RewriteEngine On
RewriteCond %{QUERY_STRING} id=(.*)
RewriteRule ^orders/invoice /store/order/view?hash=%1 [R=301,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜