post htaccess sef 的参数link
post parameters to htaccess sef link
我有 url 例如:
http://www.demo.com/a/abcd
然后我使用这个 htaccess 来 post 这个 url 的值
RewriteRule ^a/(.*)$ /details.php?sef= [L,NC]
但我需要获取新参数 posted url
例如:
http://www.demo.com/a/abcd?id=123&qu=11
那么我怎样才能通过这个 url 获得 id 和 qu 变量值而不对 URL?
来自Apache's docs on mod-rewrite:
Modifying the Query String
By default, the query string is passed through unchanged. You can,
however, create URLs in the substitution string containing a query
string part. Simply use a question mark inside the substitution string
to indicate that the following text should be re-injected into the
query string. When you want to erase an existing query string, end the
substitution string with just a question mark. To combine new and old
query strings, use the [QSA]
flag.
由于您正在重写查询字符串,因此请使用 QSA
标志:
RewriteRule ^a/(.*)$ /details.php?sef= [NC,QSA,L]
我有 url 例如:
http://www.demo.com/a/abcd
然后我使用这个 htaccess 来 post 这个 url 的值
RewriteRule ^a/(.*)$ /details.php?sef= [L,NC]
但我需要获取新参数 posted url 例如:
http://www.demo.com/a/abcd?id=123&qu=11
那么我怎样才能通过这个 url 获得 id 和 qu 变量值而不对 URL?
来自Apache's docs on mod-rewrite:
Modifying the Query String
By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the
[QSA]
flag.
由于您正在重写查询字符串,因此请使用 QSA
标志:
RewriteRule ^a/(.*)$ /details.php?sef= [NC,QSA,L]