apache .htaccess在xampp中不工作

xbp102n0  于 2023-10-23  发布在  Apache
关注(0)|答案(1)|浏览(143)

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

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

yjghlzjz1#

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

  1. </VirtualHost>
  2. <Directory /var/www/test.com/public_html>
  3. Options Indexes FollowSymLinks
  4. AllowOverride All
  5. Require all granted
  6. </Directory>

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

相关问题