WordPress MU rewrite rules
pepejose
nginx-forum at nginx.us
Thu Oct 8 18:46:01 MSD 2009
I can not fix it, this is my actual setup, i tried everything I found on google
server{
listen *:80;
server_name subdomain.domain.com;
root /xx/xxx/xxxx/;
index index.php index.html index.htm;
#necessary if using a multi-site plugin
server_name_in_redirect off;
#necessary if running Nginx behind a reverse-proxy
port_in_redirect off;
# This will reject all external requests for files with names beginning with . (dot).
location ~ /\. {
deny all;
}
#mod rewrite wordpress
rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
#Proxy the PHP scripts to Apache listening on 127.0.0.1:8080
location ~ \.php$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
server_name_in_redirect off; and port_in_redirect off; directives have not helped
The result is:
- All resquests loads index (blogs planet)
- Images of blogs generates 404....
I have analyzed this last a bit, and the problem is that for example:
http://subdomain.domain.com/userblog/files/2008/04/image.jpg == http://subdomain.domain.com/wp-content/blogs.php?file=2008/04/image.jpg
the result is -> 404 — File not found.
because do not select fine the id of the blog, id take it out of the database according to userblog, isn´t it? in that case '/userblog/' lost when apply the rewrite rule!!
http://subdomain.domain.com/wp-content/blogs.dir/ correct IdBlog is 2 to this userblog but always is 1 /files/2008/04/image.jpg
I'm going crazy, please help!
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,8334,12091#msg-12091
More information about the nginx
mailing list