【发布时间】:2012-02-13 01:10:08
【问题描述】:
我在本地计算机上的目录d:\www\mysite 中有一个网站。我安装了 WAMPServer 并为我的站点设置了一个别名目录 mysite。
例如,http://localhost/mysite/static-resource.html 正确检索了我位于 d:\www\mysite\static-resource.html 中的文件。
我的问题是我的 .htaccess 文件中的 URL 重写:
RewriteEngine On
RewriteRule ^articles/(\d+) ./article.php?id=$1
当我尝试访问 http://localhost/mysite/articles/1 时,我收到了以下响应:
未找到
在此找不到请求的 URL /www/mysite/article.php 服务器。
我可以确认d:\www\mysite\article.php 存在一个article.php 文件。
过去,我将网站的根 (d:\www\mysite) 设置为 Apache 服务器的 DocumentRoot(而不是默认的 c:\wamp\www),在这种情况下,我的 URL 重写工作,所以我当前的问题必须与我的网站位于别名目录“后面”这一事实有关。
我的mysite.conf文件的内容:
Alias /mysite/ "d:/www/mysite/"
<Directory "d:/www/mysite/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
【问题讨论】:
-
您能否确认为新的别名目录正确设置了
AllowOverride? -
@clmarquart 我不确定什么是正确设置。我已经用相关信息更新了我的问题...
标签: apache mod-rewrite wampserver