htaccess 子域中的静态文件

发布于 2024-09-28 01:25:12 字数 269 浏览 0 评论 0原文

我的主文件夹的 htaccess 中有以下内容

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^css/(.*)\.css$ - [L]
RewriteRule ^(.*)\.css$ - [L]

第二条规则工作正常。即直接访问主目录下的CSS文件。但是,这并没有传播到目录“css”。因此我创建了第一条规则。这也是行不通的。

规则不传播是否有特殊原因,或者我在这里遗漏了什么?

I have the following in the htaccess of my main folder

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^css/(.*)\.css$ - [L]
RewriteRule ^(.*)\.css$ - [L]

The second rule works fine. That is, the CSS files in the main directory are accessed directly. However, this was not propagating to the directory "css". Hence I created the first rule. That is also not working.

Is there a particular reason why the rules don't propagate or am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〆凄凉。 2024-10-05 01:25:12

我现在感觉自己好傻。事实证明重写规则都是正确的。错误与文件夹权限有关。一旦设置完毕,该网站就会按预期运行。

把这个留在这里,以防有人陷入和我一样的困境!

I feel so stupid right now. Turns out the Rewrite rules were all correct. The error was with the folder permissions. Once that was set, the site is functioning as expected.

Just leaving this here in case someone gets stuck at the same point as I did!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文