【CentOS】.htaccess不生效

sudo vi /etc/httpd/conf/httpd.conf

找到<Directory /var/www/html>部分,然后更改AllowOverride从指令NoneAll :

/etc/httpd/conf/httpd.conf

. . .
<Directory /var/www/html>
. . .
 # 
 # AllowOverride controls what directives may be placed in .htaccess files.
 # It can be "All", "None", or any combination of the keywords:
 # Options FileInfo AuthConfig Limit
 #
 AllowOverride All
. . .
</Directory>
. . .

保存并退出文件,然后重新启动Apache以应用更改:

sudo systemctl restart httpd

 转载于:https://www.howtoing.com/how-to-set-up-mod-rewrite-for-apache-on-centos-7/

猜你喜欢

转载自blog.csdn.net/weixin_41728561/article/details/81369261