其他分享
首页 > 其他分享> > Apache的htaccess不起作用【亲测备忘】

Apache的htaccess不起作用【亲测备忘】

作者:互联网

Apache 2.4.37装完之后,虚拟机下的htaccess没起作用,参考网上最终解决方法步骤如下:
1.修改Apache的httpd.conf文件,启用rewrite。
找到:#LoadModule rewrite_module modules/mod_rewrite.so去掉前面的#号。
我的是已开启,不用修改。

2.AllowOverride、Options 的设置。
配置了多个虚拟目录需在每个目录里面开启AllowOverride All,没有就添加。
同时原Options None改为Options All。
<VirtualHost 192.168.28.194:80>
DocumentRoot "/data/www/default/html/newtechwood.com"
ServerName 194.newtechwood.com
<Directory "/data/www/default/html/newtechwood.com">
AllowOverride ALL
allow from all
Options All
Require all granted
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost>

3.重启Apache服务。
发现htaccess终于生效了。

标签:index,rewrite,AllowOverride,备忘,htaccess,Apache,Options
来源: http://blog.51cto.com/418324/2344064