Knowledgebase
NGINX rewrite rules for WordPress multisite
Posted by on 27 July 2018 05:52 PM

In order to deploy WordPress multisite, the following directives should be added to Domains > example.com > Apache & nginx Settings > Additional nginx directives:

# WordPress multisite subdirectory rules. 
index index.php; 

# This order might seem weird - this is attempted to match last if rules below fail. 
# http://wiki.nginx.org/HttpCoreModule 
try_files $uri $uri/ /index.php?$args; 

# Add trailing slash to */wp-admin requests. 
rewrite /wp-admin$ $scheme://$host$uri/ permanent; 

# Directives to send expires headers and turn off 404 error logging. 
location ~* ^.+\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { 
access_log off; log_not_found off; expires max; 
}

 

Note: These rules will work for most setups. If additional customisations are required, consider using htaccess to nginx extension to convert Apache rewrite rules to Nginx ones.

(1 vote(s))
Helpful
Not helpful

Comments (0)
Copyright © 1998 - 2021 Shinjiru International Inc. All Rights Reserved.