Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

My configuration to use friendly URL works fine when the destination is a php script, like this:

RewriteRule ^products/([a-z0-9-]+)/([0-9]+)/?$ /prod.php?id=$2&name=$1 [NC]

But, when I use a static file, like below, as destination, don't works:

RewriteRule ^\/css\/\_version\_([1-9]+)\_([0-9])\/(.*)$ /stat/css/$3    [NC]

The configuration above only works when I put a redirection flag, like this:

RewriteRule ^\/css\/\_version\_([1-9]+)\_([0-9])\/(.*)$ /stat/css/$3    [R]

The destination "/stat/css/*.css" exists. When i use a "Alias" configuration it works too. But, I've to use mod_rewrite to do this.

No error logs (debug mode) are colected about it. Only 404 at access logs.

Someone can help me?

share|improve this question

Can you try (untested)

RewriteRule ^css/_version_([1-9]+)_([0-9]\/(.*)$ /stat/css/$3

Differences from your example:

  • No leading slash. This is needed in a VHost definition, but shouldn't be included in a .htaccess file, for example. Your first (working) example doesn't include this.

  • Less escaping. It doesn't seem necessary, and makes the expression more legible.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.