[英].htaccess 301 redirecting --> retrieve CSS style sheet from redirected directory
With the help of my .htaccess file, I was able to redirect all requests made on mydomain.com/folder/
or on any of it's subdomains to mydomain.com
as follows:在我的 .htaccess 文件的帮助下,我能够将在
mydomain.com/folder/
或其任何子域上发出的所有请求重定向到mydomain.com
,如下所示:
RedirectMatch 301 /folder/(.*) //
However, I happened to ran into a problem.然而,我碰巧遇到了一个问题。 I have a CSS style sheet at
mydomain.com/folder/style.css
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. 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. Nevertheless, I know that the file path used to point to the style sheet is correct.不过,我知道用于指向样式表的文件路径是正确的。
Could anyone possibly point me to the right direction?谁能指出我正确的方向?
Use this rule instead of yours -- it will redirect ALL requests that start with /folder/
EXCEPT /folder/style.css
:使用此规则而不是您的规则——它将重定向所有以
/folder/
EXCEPT /folder/style.css
开头的请求:
RedirectMatch 301 ^/folder/((?!style\.css).*) /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.