简体   繁体   English

当我将我的浏览器指向网站site.com/index.php/"non-existent-dir“时显示index.php没有css的页面

[英]When i point my browser to website site.com/index.php/“non-existent-dir” shows index.php the page with no css

Here is my .htaccess file: 这是我的.htaccess文件:

ErrorDocument 404 /404.html
Options +FollowSymlinks
Options -Indexes


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

no css styles applied 没有应用CSS样式

I dont want the page to show at all... is it not supposed to show te 404 page i configured? 我不希望页面显示...是不是应该显示我配置的te 404页面?

index.php/ is not a directory index.php /不是目录

It is because you are not using absolute path for your style/image href and src. 这是因为你没有为你的style / image href和src使用绝对路径。

<link rel="stylesheet" type="text/css" href="/design/style.css"/>
<img src="/design/mylogo.php"/>

As you can see I have added / in front of a path, so I am pointing browser to search for a file in a root location. 正如您所看到的,我已添加/在路径前面,因此我指向浏览器以在根位置搜索文件。 When you are on url http://example.com/index.php/somename browser is trying to find css/images on this location http://example.com/index.php/somename/design/style.css or http://example.com/index.php/somenamde/design/mylogo.png . 当你在网址http://example.com/index.php/somename浏览器试图在这个位置找到CSS /图像http://example.com/index.php/somename/design/style.csshttp ://example.com/index.php/somenamde/design/mylogo.png

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

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