I create a subdirectories multisite network and got problem :
links for theme or plugin search with subdirectories and not root wp-content ! if a subdirectories is "aaa" it search theme data under aaa and not root wp-content.
What is the solution please to make this network works correctly ?
Thank you

  • Dimitris
    • Support Star

    Hello there Laurent_C

    I double-checked in a site hosted with us, which is also using Nginx, and the paths are looking both good (including the subsite's path) and working:

    So this should be happening due to some misconfiguration in the Nginx level.
    Have you followed any specific tutorial/resource for setting up this server?
    Please advise!

    Here's also the official Nginx rules for subfolder multisites:
    as well as an alternative way of setting up Nginx using a helper plugin:

    Warm regards,

    • Laurent_C
      • Syntax Hero

      I already read this but I don't know where to put this script, 'global/wordpress.conf' where is this file ?
      server is lentos / Plesk / apache-nginx
      Thank you
      "For multisite subdirectory installations, here is the ‘global/wordpress.conf’ file :"

      # WordPress multisite subdirectory rules.
      # Designed to be included in any server {} block.

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

      map $blogname $blogid{
      default -999;

      #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;

      server {
      server_name ;

      root /var/www/;
      index index.php;

      location ~ ^(/[^/]+/)?files/(.+) {
      try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
      access_log off; log_not_found off; expires max;

      #avoid php readfile()
      location ^~ /blogs.dir {
      alias /var/www/ ;
      access_log off; log_not_found off; expires max;

      if (!-e $request_filename) {
      rewrite /wp-admin$ $scheme://$host$uri/ permanent;
      rewrite ^(/[^/]+)?(/wp-.*) $2 last;
      rewrite ^(/[^/]+)?(/.*\.php) $2 last;

      location / {
      try_files $uri $uri/ /index.php?$args ;

      location ~ \.php$ {
      try_files $uri =404;
      include fastcgi_params;
      fastcgi_pass php;

      #add some rules for static content expiry-headers here

  • Nastia
    • Support Rock Star


    These lines needs to be added in the /etc/nginx/nginx.conf (or /etc/nginx/conf/nginx.conf) Please keep a backup of the file, by downloading it to your local device just in case, so if something will go wrong you may always restore it.

    You should locate/edit this file on a Plesk interface, from Go Domains > > Apache & nginx Settings and add the text below in Additional nginx directives field.

    Hope this helps!

    Kind regards,

    • Laurent_C
      • Syntax Hero

      Thank you for your reply but I get this. error :
      Configuration Nginx non valide : nginx: [emerg] "map" directive is not allowed here in /var/www/vhosts/system/ADDRESS/conf/vhost_nginx.conf:84 nginx: configuration file /etc/nginx/nginx.conf test failed

      Any Idea because I had already test without anymore success

      Thank you

  • Pawel
    • Staff

    Hello Laurent_C !

    This means the configuration is invalid - mostly because the snippet provided on the site doesn't explain well how to apply it and if there's something you need to do. But there should be a fix for that.

    Please move both of the "map" lines inside the "server" part (above the line that says "#add some rules for static content expiry-headers here"). Since you have multisite with subdirectories, they will be needed there.

    Kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.