Apache htacces重定向到404

时间:2016-02-23 16:51:57

标签: 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]  

我访问此链接后,我被重定向到404页面。为什么?我的.htacces文件出了什么问题?

编辑:我阅读了文档,我认为问题出在matching,对吗?

1 个答案:

答案 0 :(得分:3)

您可以尝试:

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]