首页 > 解决方案 > 使用多个参数重写 URL 时找不到页面

问题描述

我一直在用多个参数重写 URL,但它抛出了错误 404。这是我使用的

RewriteEngine on
RewriteRule ^city/([0-9a-zA-Z]+)$ city.php?city=$1 [NC,L] -- This one Works fine
RewriteRule ^blog/([0-9a-zA-Z]+)$/([0-9a-zA-Z_-]+)$ blog.php?city=$1&cat=$2 [NC,L] -- This one is not

第二个 RewriteRule 不起作用。我也尝试过更改为 QSA,但没有成功。

标签: php.htaccess

解决方案


Options -MultiViews
RewriteEngine on
RewriteRule ^blog/([0-9a-zA-Z]+)/([0-9a-zA-Z_-]+) blog.php?city=$1&cat=$2 [NC,L] -- Removed '$' and It worked.

推荐阅读