Html 影响Permalink.htaccess以加载css文件

Html 影响Permalink.htaccess以加载css文件,html,css,.htaccess,hyperlink,permalinks,Html,Css,.htaccess,Hyperlink,Permalinks,我有 localhost/ctr/index.php?page=reload 我使用htaccess将它们转换为 localhost/ctr/index/reload 是的 RewriteEngine on RewriteRule index/([a-z]+) index.php?page=$1 [NC] 在这项工作中,带有新格式url的页面出现 但加载css文件时存在如下问题: link href="templates/plugin/bootstrap/css/bootstrap.css"

我有

localhost/ctr/index.php?page=reload

我使用htaccess将它们转换为

localhost/ctr/index/reload

是的

RewriteEngine on

RewriteRule index/([a-z]+) index.php?page=$1 [NC]
在这项工作中,带有新格式url的页面出现

但加载css文件时存在如下问题:

link href="templates/plugin/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet" 
我认为css文件加载受我在htaccess中所做的安排的影响


如何解决此问题。

您需要更改链接以使其成为绝对链接:

link href="/templates/plugin/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet" 
或者您需要在页眉中添加适当的URI基:

<base href="/">

试试这个

RewriteEngine on

RewriteCond %{DOCUMENT_ROOT} !-f
RewriteRule !\.(js|ico|gif|jpg|png|css|html|swf|flv|xml)$ index.php [QSA,L]