CSS problem after nginx rewrite for clean URLs

Nick Pearson nick.pearson at gmail.com
Wed Oct 21 18:58:19 MSD 2009


Are you using a static CSS file, or is the CSS being generated with
PHP?  What do you see when you attempt to access the CSS file
directly?

Either way, it's better to use more specific locations:

location /post {
  rewrite ...;
}

location /css {
  # css-specific settings, like "expires 10y"
}

location /images {
  # image-specific settings
}

On Wed, Oct 21, 2009 at 9:39 AM, Sujay Mahajan <lists at ruby-forum.com> wrote:
> I am writing rewrite rules in nginx for clean URLs.
>
> Following is the rule:
>
> location / {
>    if (!-e $request_filename) {
>        rewrite ^/post\/(.*)\/(.*)\/(.*)$ /post.php?a=$1&b=$2&c=$3 last;
>    }
> }
>
> Everytime I hit mydomain.com/post/123/456/abc-def it renders
> mydomain.com/post.php?a=123&b=456&c=abc-def
>
> Now the regex is right and php is rendered properly. But it is screwing
> up my css.
> The nav bar is garbled and images are not seen.
> What could be the problem?
> --
> Posted via http://www.ruby-forum.com/.
>
>





More information about the nginx mailing list