我是.htaccess文件的新手,并且一直试图在我的网站上做一些简单的重写。但是,这会导致在域中加载所有其他资源(特别是我的样式表)时出现问题。
我的.htaccess文件如下:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^category/([0-9a-zA-Z]+)$ category.php?id=$1 [NC,L]
RewriteRule ^product/([0-9a-zA-Z]+)$ product.php?id=$1 [NC,L]
RewriteRule ^page/([0-9a-zA-Z]+)$ page.php?page_id=$1 [NC,L]
RewriteRule ^(.*)$ index.php?id=$1 [QSA,L]
但后来我收到以下错误:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://example.com/beta/web/style.css".
我试图对此进行一些研究,并在某处阅读使用样式表的绝对文件路径会更好。
而不是<link rel="stylesheet" href="web/style.css" type="text/css" media="screen"/>
我输入了<link rel="stylesheet" href="http://example.com/beta/web/style.css" type="text/css" media="screen"/>
然而,这只会导致不同的错误:
Refused to apply style from 'https://example.com/EUR/web/style.css/' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
对此的任何帮助将不胜感激。