php - 使用多个参数重写 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,但没有成功。
解决方案
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.
推荐阅读
- excel - 使用 vba 宏从数据透视表中选择字段
- sql - 为sql逗号分隔字符串中的每个单词插入引号并在Function SQL中使用
- c - EXC_BAD_ACCESS 错误
- c++ - “auto x = 矢量”有什么区别
()”和“向量 X”? - sql-server - 是否有必要在 FOREIGN KEY 上定义与 PRIMARY KEY(父表)上定义的相同约束?
- c# - 使用来自 Web API 和 Swagger 的状态的正确返回类型
- fortran - 如何创建相同的 1000 个文件但更改某些特定参数?
- git - 为什么我不能将我的远程存储库克隆到我的另一台机器上?
- bash - CLI “bq load” - 如何使用不可打印字符作为分隔符?
- sql-server - 如何根据另一列的值创建空列或非空列?