Apache安装了mod_rewrite模块,并配置了http.conf,却还是无法URL重写

借助URL重写隐藏index.php入口文件,需要Apache配置mod_rewrite.so模块,根据要求配置http.conf文件。

#引用
LoadModule rewrite_module modules/mod_rewrite.so
#修改权限
AllowOverride All

随后创建.htaccess文件

重启Apache

测试发现,URL重写根本没用。

解决办法:

1 先确认是否安装了mod_rewrite模块,如果没有,yum install mod_rewrite

2 确认路径是否正确,例如上述引用代码,最好绝对地址引用

3 mod_rewrite.so权限问题,确认是755