Php ApacheHtacces重定向到404
我有这个链接,我可以访问:Php ApacheHtacces重定向到404,php,.htaccess,http-status-code-404,Php,.htaccess,Http Status Code 404,我有这个链接,我可以访问: http://domain.com/search/csgo/US/nameorip/?matching=dust2 .htaccess如下所示: RewriteRule ^search/([a-z_]+)/([A-Z_]+)/([a-z]+)/?matching=(.*)?$ servers.php?game=$1&location=$2&query_by=$3&matching=$4 [NC,L] 在我访问这个链接后,我也被重定
http://domain.com/search/csgo/US/nameorip/?matching=dust2
.htaccess如下所示:
RewriteRule ^search/([a-z_]+)/([A-Z_]+)/([a-z]+)/?matching=(.*)?$ servers.php?game=$1&location=$2&query_by=$3&matching=$4 [NC,L]
在我访问这个链接后,我也被重定向到404页面。为什么?我的.htacces
文件有什么问题
编辑:我阅读了文档,我认为在匹配方面存在问题,对吗?您可以尝试:
RewriteCond %{QUERY_STRING} ^matching=([^&]+)$ [NC]
RewriteRule ^search/([a-z_]+)/([A-Z_]+)/([a-z]+)/?$ servers.php?game=$1&location=$2&query_by=$3&matching=%1 [NC,L]
这是正确的。不能在重写模式中检查查询字符串。您需要使用
RewriteCond%{QUERY\u STRING}^ matching=([^&])$[NC]
检查它。很抱歉,将+
留在那里-应该是[^&]+
,如下面的答案所示。