I have this url:
我有这个网址:
example.com/en/hk/myAccount?Ref=CC0000008
And my .htaccess looks like this:
我的.htaccess看起来像这样:
Options +SymLinksIfOwnerMatch
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^(chin|en)/(hk|kw)/myAccount/?$ user_account.php?lang=$1&loc=$2& [NC,L] #SHOW USER ACCOUNT
So I want to get now the variable ref
passed on the url but when I print_r
the variabel $_GET
I only get the variables in the .htaccess
file.
所以我想现在得到在url上传递的变量ref,但是当我print_r的变量$ _GET时,我只得到.htaccess文件中的变量。
What should I do?
我该怎么办?
1 个解决方案
#1
1
You need to add QSA
flag
您需要添加QSA标志
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^(chin|en)/(hk|kw)/myAccount/?$ user_account.php?lang=$1&loc=$2 [QSA,NC,L]
Output:
输出:
Array ( [lang] => en [loc] => hk [Ref] => CC0000008 )
The flag QSA
means that if there's a query string passed with the original URL, appended it.
标志QSA表示如果有一个与原始URL一起传递的查询字符串,则附加它。
The flag L
means if the rule matches, don't process any more rules below this one.
标志L表示如果规则匹配,则不再处理此规则以下的任何规则。
The flag NC
means case-insensitive, that is, it doesn't care whether letters appear as upper-case or lower-case in the matched URI.
标志NC表示不区分大小写,也就是说,它不关心字母在匹配的URI中是以大写形式还是小写形式出现。
Apache RewriteRule标志
#1
1
You need to add QSA
flag
您需要添加QSA标志
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^(chin|en)/(hk|kw)/myAccount/?$ user_account.php?lang=$1&loc=$2 [QSA,NC,L]
Output:
输出:
Array ( [lang] => en [loc] => hk [Ref] => CC0000008 )
The flag QSA
means that if there's a query string passed with the original URL, appended it.
标志QSA表示如果有一个与原始URL一起传递的查询字符串,则附加它。
The flag L
means if the rule matches, don't process any more rules below this one.
标志L表示如果规则匹配,则不再处理此规则以下的任何规则。
The flag NC
means case-insensitive, that is, it doesn't care whether letters appear as upper-case or lower-case in the matched URI.
标志NC表示不区分大小写,也就是说,它不关心字母在匹配的URI中是以大写形式还是小写形式出现。
Apache RewriteRule标志