Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, but some page I wrote the rule and direct browser via friendly url to, then the request for css file could not find.

Anybody has experience please help.


share|improve this question

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.