重写规则不适用于css,js和图像

时间:2016-11-14 08:58:07

标签: php

⁠⁠θFile结构:

htdoc
|--project
   |--admin
      |--css
      |--js
      |--images
      |--.htaccess
      |--index.php

.htaccess文件包含:

RewriteEngine on
RewriteBase /project/admin/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?PATH_INFO=$1 [L,QSA]

当我浏览以下链接时,每件事情都能正常运作。

localhost/project/admin/profile

但是当我浏览以下链接时,css js和图像没有加载

localhost/project/admin/profile/

的index.php css链接就像那样

href="css/style.css"

请帮忙。

1 个答案:

答案 0 :(得分:1)

您必须使用完整路径从重定向页面调用css / js / images。例如: http://localhost/project/admin/css/style.css

相关问题