我在.htaccess中遗漏了一些东西,
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # CATEGORIES RewriteRule ^categories/(.*)$ /newwebsite/rewrite_cats.php?category=$1 [L,NC] # PRODUCT AND SERVICES RewriteRule ^(.*)/(.*)$ /newwebsite/rewrite.php?sub=$1&second=$2 [L,NC]
我不知道这有什么问题,但是当我访问我的网站时,我看不到应用的样式和JavaScript,如果我删除这一行就可以了:
RewriteRule ^categories/(.*)$ /newwebsite/rewrite_cats.php?category=$1 [L,NC]
我在Chrome控制台中收到的错误如下:
Resource interpreted as Image but transferred with MIME type text/html: Resource interpreted as Script but transferred with MIME type text/html: Resource interpreted as Stylesheet but transferred with MIME type text/html:
如果我删除或评论第一个RewriteRule行,一切正常。 我不知道发生了什么,有人可以帮助我吗?
我意识到这是关于结合这两条规则的事情。当我评论第二个时,一切都很完美。
答案 0 :(得分:3)
添加
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
在你的规则之前
哦,我希望您使用CSS的绝对路径