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終於生效了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章