簡體   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