服務器(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 然后補寫上自己所需的所需規則。