【发布时间】:2016-06-05 15:17:50
【问题描述】:
我有这个链接,我可以访问:
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 文件有什么问题?
编辑:我阅读了文档,我认为matching 有问题,对吧?
【问题讨论】:
-
没错。您无法检查重写模式中的查询字符串。您需要使用
RewriteCond %{QUERY_STRING} ^matching=([^&])$ [NC]进行检查。 -
抱歉,将
+留在那里 - 应该是[^&]+,如下面的答案所示。
标签: php .htaccess http-status-code-404