.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]
精彩评论