I am working with WordPress Multisite (with sub-directory structure). Everything works fine instead of WordPress pages. When I publish a page and I try to visit it, it redirects to the main multisite.
So for example, if the page is in this path:
https://example.com/en-us/my-new-page/
it automatically redirects to:
Or another example, if the page is in this path:
https://example.com/es-es/my-really-new-page/
it automatically redirects to:
I am using a plugin called Custom Permalinks to make posts URLs look nicer. I am using nginx as web server. I am developing the site, so currently on an IP, not a domain. I am redirecting the current root domain https://example.com/ to the main multisite path https://example.com/en-us/ with Redirection plugin.
This is my nginx conf file:
upstream php-handler-http {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
map $http_host $blogid {
default 0;
include /var/www/html/wp-content/uploads/nginx-helper/map.conf;
}
server {
listen 80 default_server;
server_name 123.123.123.123;
root /var/www/html/;
index index.php;
access_log /var/log/nginx/wordpress_http_access.log combined;
error_log /var/log/nginx/wordpress_http_error.log;
# set max upload size
client_max_body_size 2G;
fastcgi_buffers 64 4K;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ .php(?:$|/) {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php-handler-http;
fastcgi_read_timeout 600;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* .(htaccess|htpasswd) {
deny all;
}
# set long EXPIRES header on static assets
location ~* .(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 24h;
access_log off;
}
}