Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Good Morning,

I am trying to create RewriteRule for all request for css file within my website to css/filename.css. The procedure is all css files within my website store only in mydomain.com/css/filename.css, but some page I wrote the rule and direct browser via friendly url to mydomain.com/services/index.html, then the request for css file could not find.

Anybody has experience please help.


share|improve this question

1 Answer 1

Match on any request that ends with .css and rewrite it to be /css/filename.css? This should do it:

RewriteRule \.css$ /css/filename.css [NC]

Don't forget to add RewriteEngine On if you don't already have it.

Edit: I added the NC flag to the rewrite, to catch mixed case, ie: .Css or .CSS

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.