繁体   English   中英

.htaccess 301 重定向 --> 从重定向目录中检索 CSS 样式表

[英].htaccess 301 redirecting --> retrieve CSS style sheet from redirected directory

在我的 .htaccess 文件的帮助下,我能够将在mydomain.com/folder/或其任何子域上发出的所有请求重定向到mydomain.com ,如下所示:

RedirectMatch 301 /folder/(.*) //

然而,我碰巧遇到了一个问题。 I have a CSS style sheet at mydomain.com/folder/style.css 8CBA22E28EB17B5F5C6AE2A266AZ and I want to link it to a HTML file at mydomain.com/file.html , but the HTML fails to recognize and/or open the CSS style sheet. 不过,我知道用于指向样式表的文件路径是正确的。

谁能指出我正确的方向?

使用此规则而不是您的规则——它将重定向所有以/folder/ EXCEPT /folder/style.css开头的请求:

RedirectMatch 301 ^/folder/((?!style\.css).*) /

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM