PTED为脚本,但MIME类型的文本传输的.htaccess资源跨$ P $ / HTML脚本、文本、类型、资源

2023-09-02 09:46:14 作者:除了我全世界都是猪

我有一个很大的问题后,我加入这行到我的htaccess的:

I've a big problem after I add this line into my htaccess:

RewriteRule ([a-z]+)/   index.php?p=$1 [L]

我有这样的错误:

I have error like that:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/media/css/lvnr.min.css".
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost/media/js/bootstrap.min.js".

我觉得现在的问题是,我的htaccess的尝试重定向所有链路媒体/ ......到index.php?P = ......

I think that the problem is that my htaccess try to redirect all the link media/... to index.php?p= ...

那么如何解决这个问题,请

So how to fix it please

推荐答案

正如你已经假定,您的规则相匹配的媒体/ ... 你可能希望你的正则表达式来结束$:

As you already assumed, your rule matches your media/... You probably want your regex to end on $:

RewriteRule ([a-z]+)/$   index.php?p=$1 [L]

编辑:另外你可能会感兴趣的装载从CDN有更好的表现,公共图书馆像自举:

Also you might be interested in loading public libraries like boostrap from a CDN for better performance:

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>