开发者

Nginx Rewrite rules for clean URLs (issue with CSS and JS rendering)

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 si开发者_StackOverflowde. 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜