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

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

1 Answer 1

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

 
discard

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.