我试图推行清洁网址到我的网站,但我拼命地跑了一个问题。当我试图加载只是默认网址feks:www.example.com,一切正常,因为它应该,但是当我试图改变这样的:www.example.com/home/,一切加载,除了我的图片和我的CSS。
只是一些测试HTML:
< HTML>
< HEAD>
<元的charset =UTF-8>
<冠军>< /标题>
<链接HREF =css.css相对=样式类型=文本/ CSS>
< /头>
<身体GT;
< P>只是一个例子文字< / P>
< /身体GT;
< / HTML>
我的htaccess文件:
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^的index.php [L]
< / IfModule>
解决方案
您必须使用绝对链接:
<链接HREF =http://www.example.com/css.css相对=样式类型=文本/ CSS>
或添加在< HEAD>
:
<基地的HREF =http://www.example.com/>
或
<基地的HREF =/>
I'm trying to implement clean url's to my website, but I've runned into a problem. When i'm trying to load just the default url feks: www.example.com, everything works as it should, but when i try changing it like this: www.example.com/home/, everything loads except my images and my css.
Just some testing html:
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>just an example text</p>
</body>
</html>
My htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
解决方案
You must use absolute links:
<link href="http://www.example.com/css.css" rel="stylesheet" type="text/css">
or add in the <head>
:
<base href="http://www.example.com/">
or
<base href="/">
上一篇:通用的.htaccess的angularjs,随着HTML5的路由参数的工作原理路由、工作原理、参数、htaccess
下一篇:301重定向与htaccess的距离的tumblr到Word preSS重定向、距离、htaccess、Word