Nginx

Using WordPress Multi User (WPMU)

By 5th November 2013September 15th, 2020No Comments

In order to use WordPress with its multi-blog functionality, you need to apply a few rewrite rules to support it. Normally, WordPress would use .htaccess format rules, so these need translating into Nginx format.

Here is an example if your main WordPress installation is located in /wp

# add a trailing slash to /wp-admin
rewrite ^/wp/([_0-9a-zA-Z-]+/)?wp-admin$ /wp/$1wp-admin/ permanent;
location ~* ^/wp/([_0-9a-zA-Z-]+/)?(.*\.php)$ {
  include fastcgi_params;
  try_files $uri $uri/ /wp/$2$is_args$args;
}
location ~* ^/wp/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) {
  try_files $uri $uri/ /wp/$2$is_args$args;
}
location @wordpress {
  rewrite . /wp/index.php last;
}