简体   繁体   中英

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

I have the following files in apache server:

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

I have edited httpd.conf so if user types an address like localhost/wrongpage.php apache shows localhost/pageNotFound.php. My problem is that when a user types localhost/index.php/blablaitypewhateveriwant or even localhost/index.php/, page index.php comes up with an awful appearence (no css or javascript enabled). So i want to restrict access cases like these and show pageNotFound.php

edit: To make things easier visit those links to see the difference: http://www.developphp.com/donate.php , http://www.developphp.com/donate.php/blahblah

您可以修改.htaccess

ERRORDOCUMENT 404 /pageNotFound.php

Following your edit. You requested page is not a 404. But in your developer tool you can read :

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

You can solve this problem by changing all your css/javascript include by adding slashes. For instance :

style/layout_001.css to /style/layout_001.css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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