Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.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 htaccess_Php_Regex_.htaccess_Url_Url Rewriting - Fatal编程技术网

Php 如何允许/读取百分比登录url htaccess

Php 如何允许/读取百分比登录url htaccess,php,regex,.htaccess,url,url-rewriting,Php,Regex,.htaccess,Url,Url Rewriting,我正在使用htaccess规则重写url RewriteCond %{THE_REQUEST} /buy-car\.php\?make=([^\s&]+)&model=([^\s&]+)&year=([^\s&]+)\s [NC] RewriteRule ^ buy-car/%1/%2/%3? [R=302,L] RewriteRule ^buy-car/([\w-]+)/([\w-]+)/([\w-]+)/?$ buy-car.php?make=$1&

我正在使用htaccess规则重写url

RewriteCond %{THE_REQUEST} /buy-car\.php\?make=([^\s&]+)&model=([^\s&]+)&year=([^\s&]+)\s [NC]
RewriteRule ^ buy-car/%1/%2/%3? [R=302,L]

RewriteRule ^buy-car/([\w-]+)/([\w-]+)/([\w-]+)/?$ buy-car.php?make=$1&model=$2&year=$3 [L,QSA,NC]
这使得url像

 www.example.com/buy-car/audi/x5/2015
但有时我可能会有这样的网址

www.example.com/buy-car/audi/x5/2000%3B2015

%3B represents ;  
现在,如何更改我的htaccess规则以正常工作


谢谢

在%前面加一个反斜杠。尝试在regexp中使用:([\%\w-]+)。

Allow
在角色类中。第二条规则为:

RewriteRule ^buy-car/([\w;-]+)/([\w;-]+)/([\w;-]+)/?$ buy-car.php?make=$1&model=$2&year=$3 [L,QSA,NC]

是否尝试使用“%25”而不是文字“%”?此外,还有大量的相关信息