我最近在我的电脑上设置了XAMPP,并尝试使用网址重写。
AllowOverride设置为All。
摘自我的httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
DocumentRoot "D:/xampp/htdocs"
<Directory "D:/xampp/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
所以我创建了一个名为D的子文件夹:/ xampp / htdocs / test /并在其中创建了一个.htaccess文件,如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
另外我在同一个文件夹中放了一个空的index.php。 重写不起作用。我可以访问localhost / test /并获得一个空白页面,但在测试/结果后写入404错误... 我在任何日志文件中都没有看到任何内容(访问/错误)
统计:
Windows 10 Home XAMPP 7.0.6 Apache 2.4
答案 0 :(得分:0)
在C:\上重新安装XAMPP似乎解决了这个问题。