wordpress rewrite nginx

Igor Sysoev is at rambler-co.ru
Wed Feb 14 16:21:49 MSK 2007


On Wed, Feb 14, 2007 at 12:09:05PM +0200, Anonymous Coward wrote:

Let's start from the scratch:

1) set the root at server level,
2) and move all if/rewrite rules to server level, then they will run
   only once:

    server {
        ...

        root    /var/www/localhost/htdocs/sub.domain.tld;

        #uploaded files
        rewrite  ^(.*)?/?files/(.*) /wp-content/blogs.php?file=$2;

        if (!-e $request_filename) {
            rewrite  ^.+?(/wp-.*)     $2          last;
            rewrite  ^.+?(/.*\.php)$  $2          last;
            rewrite  ^                /index.php  last;
        }

        ...
    }


The "^([_0-9a-zA-Z-]+)?(/wp-.*)" does not match "/test130/wp-content/...".


> I tried that too, same result...
> I also looked in access.log and i noticed that i was getting 404 on these
> files
> 
> /test130/wp-content/themes/default/style.css
> /test130/wp-content/themes/default/images/kubrickbg.jpg
> 
> On website i was trying to access sub.domain.tld/test130/   (which is a blog
> in Wordpress Mu) and on the server the files were in
> 
> $documentroot/wp-content/themes/home/images/kubrickbg.jpg
> $documentroot/wp-content/themes/default/images/kubrickbg.jpg
> 
> $documentroot/wp-content/themes/home/style.css
> $documentroot/wp-content/themes/default/style.css
> $documentroot/wp-content/themes/classic/style.css
> 
> Maybe this will clear something...
> 
> It's seems that "^([_0-9a-zA-Z-]+)?(/wp-.*)" are static files, so "break"
> >stops rewrite cycle. The "last" continues rewrite cycle and request will
> >go to "location ~ .php$".


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list