0

I have this rule in my server:

url.rewrite-once = (
    ".*\.(js|ico|gif|jpg|png|css|)$" => "$0",
    "^/.*(\?.*)" => "/index.php$1",
    "" => "/index.php"
)

and it works as it should be... except for a little detail. If I add get info to the js or css files then it redirects the request to index.php. If I have this:

/css/main.css

it loads the css, but if I add:

/css/main.css?version=1234

Then it try to load /index.php/main.css/?version=1234

What its wrong with my rule?

Cito
  • 1,659
  • 3
  • 22
  • 49

1 Answers1

1

The rule .*\.(js|ico|gif|jpg|png|css|)$, and specially the $ at the end, says that the url must ends with one of the extension inside parenthesis.

If you remove the $ at the end, it should works.

Or you can add a new rule that will be specific for css and/or js with a version parameter:

.*\.(js|ico|gif|jpg|png|css|)\?version\=[0-9]+$
j0k
  • 22,600
  • 28
  • 79
  • 90