繁体   English   中英

当用户请求index.php / blahblahblah时,显示“找不到页面”

[英]Show “page not found” when user requests index.php/blahblahblah

我在apache服务器中有以下文件:

pageNotFound.php
index.php
style.css
login.php

我已经编辑了httpd.conf,因此,如果用户键入的地址类似localhost / wrongpage.php,则apache将显示localhost / pageNotFound.php。 我的问题是,当用户键入localhost / index.php / blablaitypewhateveriwant或什至localhost / index.php /时,页面index.php都会出现可怕的外观(未启用css或javascript)。 所以我想限制这样的访问情况并显示pageNotFound.php

编辑:为了使事情变得更容易,请访问那些链接以查看不同之处: http : //www.developphp.com/donate.php,http : //www.developphp.com/donate.php/blahblah

您可以修改.htaccess

ERRORDOCUMENT 404 /pageNotFound.php

按照您的编辑。 您请求的页面不是404。但是在开发人员工具中,您可以阅读:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://www.developphp.com/donate.php/style/layout_001.css". [...]

您可以通过添加所有斜线来更改所有CSS / JavaScript来解决此问题。 例如 :

style/layout_001.css/style/layout_001.css

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM