views:

433

answers:

1

I want to write nginx rewrite rules for clean URLs.

Everytime the user hits http://domain.com/abc/12/16/abc-def-ghi I need to execute domain.com/abc.php?a=12&b=16&c=abc-def-ghi.

Now my regex is right as per rubular: ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$

and rule is

if (!-e $request_filename) { rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ /abc.php?a=$1&b=$2&c=$3 last; }

The rules work fine and the page is rendered but I get a garbled CSS. My top navigation bar appears as a three line bar at the leftmost side. So I guess although PHP is working fine, the CSS files are having a problem. Is it because I am missing in adding something or the way I write my CSS? With the original URL (w/o) the rule the CSS is rendered properly and I see the Nav Bar as it should be seen.

A: 

This might be a strange question, but are you accessing this CSS file via SSL with gzip turned on?...

I had some issues a few months back with nginx garbling some javascript files (only really BIG ones), but only when gzip was turned on and it was getting sent over SSL... If I recall correctly I upgraded to a new version of nginx or turned off gzip for the offending files.

Garrett Bluma