【发布时间】:2016-01-08 14:15:13
【问题描述】:
前言:是的,这个问题似乎重复了,我找到了相关的问题,但那里的答案对我没有帮助。 :(
您好,我想为我的 PHP 项目添加人类可读的 URL 支持。现在我的 URL 查询字符串看起来像:
index.php?url=main/index
我想让它看起来像:
index.php/main/index
我阅读了以下文章:
但是当我这样做时:
var_dump($_GET['url']); // get empty array
,获取空数组,就像没有添加url参数一样。
我现在的.htaccess:
DirectoryIndex index.php
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?url=$1 [NC]
有人可以帮帮我吗?谢谢!
【问题讨论】:
-
URL是否仍然重写但不通过$_GET中的url?
-
您的 htaccess 是在根文件夹中还是在子文件夹中?此外,您必须添加一个条件以避免循环
标签: php apache .htaccess mod-rewrite url-rewriting