我为正在工作的网站的urlrewrite创建了.htaccess文件。添加.htaccess后,它将停止加载JavaScript和CSS。因此,我添加了AddType text/css .css
和AddType text/javascript .js
。但是我得到了同样的错误。以下是我的.htaccess代码:
<IfModule mod_rewrite.c>
RewriteBase /downsouthlk.comV3/
RewriteEngine On
AddType text/css .css
AddType text/javascript .js
#Turn on the rewriting engine
RewriteRule ^admin/dash/?$ /admin/dash.php [NC,L]
RewriteRule ^admin/addcity/?$ /admin/addCity.php [NC,L]
</IfModule>
这是我从chrome开发人员选项中得到的错误:
资源被解释为脚本,但以MIME类型text / html传输
资源被解释为样式表,但以MIME类型text / html传输
您的问题是在CSS / JS链接中使用了相对链接。确保在css,js,图像文件中使用绝对路径,而不要使用相对路径。这意味着您必须确保这些文件的路径以http://
或斜杠开头/
。
否则,您可以尝试将其添加到页面的HTML标头中: <base href="/" />
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句