Wordpress nginx map value not working in cloudpanel.io

826 views Asked by At

I want to set up WordPress Multisite Subdirectory rules but i get this error "Vhost is not valid."

map $uri $blogname{
~^(?P/[^/]+/)files/(.*) $blogpath ;
}

map $blogname $blogid{
default -999;
include /var/www/html/wp-content/uploads/nginx-helper/map.conf;
}
server { ...

thx :)

1

There are 1 answers

0
biocyberman On

According to this blog. You need to add this crucial part into your server:

        # Rewrite requests to /wp-.* on subdirectory installs.
        if (!-e $request_filename) {
                rewrite /wp-admin$ $scheme://$host$uri/ permanent;
                rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
                rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
        }