Nginx configuration rules enable the multi-site feature for WordPress

Source: Internet
Author: User

Nginx configuration rules enable the multi-site feature for WordPress

When you enable the WordPress multi-site mode, you will be prompted to write a rewrite file to the. htaccess file, as shown below:

1234567891011
RewriteEngine OnRewriteBase/RewriteRule ^ index \. php $-[L] # uploaded filesRewriteRule ^ files/(. +) wp-uplodes/ms-files.php? File = $1 [L] RewriteCond % {REQUEST_FILENAME}-f [OR] RewriteCond % {REQUEST_FILENAME}-dRewriteRule ^-[L] RewriteRule. index. php [L]

However, the above rules are applied to Apache and won't work in Nginx. You need to adjust the rules as follows:

Find/usr/local/nginx/conf on the Server and use vi to edit the Server module in nginx. conf. Add the following content:

123456789101112
# On server block # necessary if using a multi-site pluginserver_name_in_redirect off; # necessary if running Nginx behind a reverse-proxyport_in_redirect off; rewrite ^. */files /(. *) $/wp-DES/ms-files.php? File = $1 last; if (! -E $ request_filename) {rewrite ^. +? (/Wp-. *) $1 last; rewrite ^. +? (/. * \. Php) $1 last; rewrite ^/index. php last ;}

After modification, access/usr/local/nginx/sbin and execute./nginx-s reload.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.