开发者

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

开发者 https://www.devze.com 2023-03-19 14:53 出处:网络
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:

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:

RedirectMatch 301 /folder/(.*) //

However, I happened to ran into a problem. I have a CSS style sheet at mydomain.com/folder/style.cs开发者_运维问答s 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:

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

精彩评论

暂无评论...
验证码 换一张
取 消