【发布时间】:2012-05-31 17:26:15
【问题描述】:
所以我正在尝试在 PHP 中构建一个干净的 url 系统,以将这样的 URL 更改为 http://example.com/index.php?projects=05 为:http://example.com/projects/05
到目前为止,我已经弄清楚如何使用parse_url 来映射看起来像http://example.com/index.php/projects/05 的网址,但我不知道如何从网址中删除“index.php”。有没有办法使用 .htaccess 从 url 字符串中删除 index.php?
我知道这是一个简单的问题,但经过大量谷歌搜索后,我找不到解决方案。
【问题讨论】:
-
你应该在 .htaccess 中使用 mod rewrite 将 /index.php 转换为 /。
标签: php http url url-mapping