当前位置 : 主页 > 网页制作 > HTTP/TCP >

Object not found! The requested URL was not found on this server.... 报错解决方案

来源:互联网 收集:自由互联 发布时间:2021-06-16
服务器(centos6.5)lnmp 报错如下 Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think th

服务器(centos6.5) lnmp

报错如下

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster. Error 404

看提示是URL地址错误。原因是没有设置服务器地址重写,或者是设置了.htaccess文件,但没有打开重写功能。

解决办法是增加一个.htaccess文件,里面加上重写规则

1.找到/opt/lampp/etc(根据自身所在位置) vi httpd.conf看看是否开启了url_rewrite模块,也就是httpd.conf  LoadModule rewrite_module modules/mod_rewrite.so 将前面的#去掉,如果没有这复制这段添加上去。
然后找到 AllowOverride all (默认是None !!!这个很重要)

2.在所需要进行rewrite的web的主目录下添加.htaccess文件,添加上一句话:RewriteEngine on 然后补写上自己所需的所需规则。

网友评论