【发布时间】:2013-04-01 07:08:00
【问题描述】:
我在我的应用程序中使用了简单的 URL 重写。
RewriteEngine On
RewriteRule ^show/([a-zA-Z0-9]+)/([0-9]+)$ /show.php?d=$1&id=$2
RewriteRule ^sitemap/([a-zA-Z0-9]+)$ /sitemap.php?d=$1
RewriteRule ^sitemap/([a-zA-Z0-9]+)/([0-9]+)$ /sitemap.php?d=$1&page=$2
所有重定向都很好,但问题在于它们没有在过程中传输的 url 参数。
即,我到达了example.com/show/district/id,但脚本的行为就好像它到达了example.com/show.php。我在php中使用var_dump()进行调试,var_dump($_GET)返回了一个空数组。
注意:我是 htaccess 和 url 重写的新手,所以实际上无法从任何其他问题中找到我的答案,请帮助。
【问题讨论】:
-
example.com/district/id将不符合您的任何规则。是不是笔误? -
@Mike Anthony 这是一个错字,你能帮我解决这个问题吗?我已经编辑过了。
标签: apache .htaccess url mod-rewrite url-rewriting