apache .htaccess在xampp中不工作

xbp102n0  于 12个月前  发布在  Apache
关注(0)|答案(1)|浏览(108)

.htaccess在我的系统中不起作用。我做了以下事情。
在httpd.conf文件中包含mod_rewrite. so文件
并已将所有Allowoverride None更改为Allowoverride All
并已重新启动服务器。但它仍然不起作用。有人能帮帮我吗?
这是我的.htaccess文件

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html http://www.google.com/? [R=301,L]
yjghlzjz

yjghlzjz1#

这是它可能不起作用的一个原因:
您应该在服务器的虚拟主机文件中添加以下配置指令,以允许DocumentRoot目录中的.htaccess文件。如果不添加以下行,.htaccess文件将无法工作:

</VirtualHost>
<Directory /var/www/test.com/public_html>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

参见https://www.redhat.com/sysadmin/beginners-guide-redirects-htaccess

相关问题