Nginx Tips
Multi Level SubDirectory Setup which is not a multisite.
If a multilevel subdirectory install is required , make sure /dir/mappedsite is a symbolic link . For single level the rewrite is not required. Also make sure that safe path is updated accordingly.
# If subdirectory is there match files inside the subdirectory
location /de/fernstudium {
index index.php index.html index.htm;
try_files $uri $uri/ /de/fernstudium/index.php?q=$uri&$args;
}
# So that /de is not matched as a domain
rewrite ^/de(.?!(fernstudium)*)$ $1 last;
Subdirectory Setup with reverse proxy
This is used when the subdirectory is on a different server. wordpress homeurl and siteurl also to be updated.
location ~/news(.*)$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host news.erudera.com;
proxy_pass http://172.104.155.54:80$1$is_args$args;
}