Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 友好的url don';不能识别变量_Php_.htaccess - Fatal编程技术网

Php 友好的url don';不能识别变量

Php 友好的url don';不能识别变量,php,.htaccess,Php,.htaccess,我在我的.htaccess中使用 重写规则^profiles/([A-Za-z0-9-]+)/$/profile.php?城市=$1[NC] 访问url时正常工作: https://site.com.br/profiles/londres 但在页面中,在插入变量get后,php仅识别htaccess中配置的变量,例如访问url时: https://site.com.br/profiles/londres?s=username print\r($\u-GET) 返回 Array([city]=>l

我在我的
.htaccess中使用

重写规则^profiles/([A-Za-z0-9-]+)/$/profile.php?城市=$1[NC]

访问url时正常工作:
https://site.com.br/profiles/londres

但在页面中,在插入变量
get
后,php仅识别htaccess中配置的变量,例如访问url时:

https://site.com.br/profiles/londres?s=username

print\r($\u-GET)
返回
Array([city]=>londres)


也就是说,它不会返回GET中的变量
s
使用规则中的
QSA
标志来获取查询字符串

RewriteRule ^profiles/([A-Za-z0-9-]+)/$ /profile.php?city=$1 [NC,QSA]
参考:


在规则中使用
QSA
标志来获取查询字符串

RewriteRule ^profiles/([A-Za-z0-9-]+)/$ /profile.php?city=$1 [NC,QSA]
参考: