wordpress rewrite nginx
Hone
developerhondev at gmail.com
Mon Nov 12 06:54:58 MSK 2007
location /test/ {
if (!-e $request_filename) {
rewrite ^/test/.+?(/wp-.*) /test/$1 last;
rewrite ^/test/.+?(/.*\.php)$ /test/$1 last;
rewrite ^/test/(.*)$ /test/index.php?q=$1 last;
break;
}
}
> location ~ .php$ {...}
I have a backslash before the .php$:
location ~ \.php$ {
Also make sure you have this for static files used by the wordpress admin at the beginning of your conf.
location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|
xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root /home/YOURSITE/public_html;
expires 30d;
break;
}
On Sun, 2007-11-11 at 02:22 +0000, Kirill T. wrote:
> 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:
> #1
> location /test/ {
> if (!-e $request_filename) {
> rewrite ^.+?(/.*\.php)$ /test$1 last;
> rewrite ^.+?(/wp-.*) /test$1 last;
> rewrite ^ /test/index.php last;
> }
> }
> #2
> 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?
>
>
>
--
http://www.honewatson.com
More information about the nginx
mailing list