wordpress rewrite nginx

Kirill T. tkd.pub at gmail.com
Sun Nov 11 05:22:20 MSK 2007

My wordpress blog is located in subfolder. So i`m putting rewrite rule into
location block of subfolder. Problem is that rule wich rewrites .php files
conflicts with "location ~ .php$" which is higher (in server block) than
rewriting rule.

Config part:
        location /test/ {
          if (!-e $request_filename) {
            rewrite  ^.+?(/.*\.php)$  /test$1          last;
            rewrite  ^.+?(/wp-.*)     /test$1          last;
            rewrite  ^                /test/index.php  last;
        location ~ .php$ {...}

So it passes directly second without checking 1st and we get 404 error. How i
can force nginx to check #1 at first or may be exists another way?

More information about the nginx mailing list