【发布时间】:2013-11-02 09:08:51
【问题描述】:
你能看出以下 apache 重写规则有什么问题吗:
这是在我的 .htaccess 文件中的一个名为“text”的文件夹中,localhost/lombardpress 的子目录我有以下规则
Options +FollowSymlinks
RewriteEngine on
RewriteRule ([^/]+) /textdisplay.php?fs=$1 [NC]
我期待这个输入:
http://localhost/lombardpress-dev/text/lectio1
重写为:
http://localhost/lombardpress-dev/text/textdisplay?fs=lectio1
但是我得到了一个 404 错误。
在此服务器上找不到请求的 URL /textdisplay.php。
在我看来,RewriteRule 重写了地址,但不是我想要的 - 所以我的正则表达式一定有问题。
如果我能提供更多信息,请告诉我。
【问题讨论】:
-
您应该使用 RewriteBase /lombardpress-dev/text/ 并从 /textdisplay.php?fs=$1 到 textdisplay.php?fs=$1 中删除第一个斜线
-
我不熟悉 RewriteBase。你能写出那会是什么样子吗?
标签: .htaccess mod-rewrite