我在apache服务器中有以下文件:
pageNotFound.php
index.php
style.css
login.php
我已经编辑了httpd.conf,所以如果用户键入像localhost/错误页面.php这样的地址,apache会显示localhost/pageNotFound.php。我的问题是,当用户键入localhost/index.php/bblablaitypewhateveriwant甚至localhost/index.php/时,页面index.php会出现糟糕的外观(没有启用css或javascript(。所以我想限制这样的访问情况,并显示pageNotFound.php
编辑:为了让事情变得更容易,请访问这些链接以查看差异:http://www.developphp.com/donate.php,http://www.developphp.com/donate.php/blahblah
编辑之后。您请求的页面不是404。但在您的开发工具中,您可以阅读:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://www.developphp.com/donate.php/style/layout_001.css".
[…]
您可以通过添加斜线来更改所有的css/javascript include来解决这个问题。例如:
style/layout_001.css
到/style/layout_001.css
您可以修改.htaccess
ERRORDOCUMENT 404 /pageNotFound.php