WordPress Multisite DO+Serverpilot error 301/302

Good morning guys, I want to setup a wordpress multisite subdirectory hosted in DO and working with serverpilot. When I change the .htaccess and wp-config.php I can’t even login it shows a blank page, redirects from to and in Developer Tools appears like a error 301/302 loop. Sincerely I don’t know what is happening, ok I know it’s the first time that I setup a multisite in a VPS host, however in a shared host I can al the times setup that successfully.

So this is my .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

And my wp-config.php file

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', '');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Thank you very much for your help :)

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@luismiguelopes - If your site is down as a result of the .htaccess configuration, you can always backup your .htaccess (download a copy) and then delete it from your web root after commenting out the define lines in wp-config.php. Once you’ve done this, refresh the page and/or attempt to access yourdomain.ext/wp-admin and a new .htaccess should be generated for you (if not, clicking “save” on the permalinks page will regenerate it for you).

When commented out, the lines should look like:

//define( 'MULTISITE', true );
//define( 'SUBDOMAIN_INSTALL', false );
//define( 'DOMAIN_CURRENT_SITE', 'yourdomain.ext' );
//define( 'PATH_CURRENT_SITE', '/' );
//define( 'SITE_ID_CURRENT_SITE', 1 );
//define( 'BLOG_ID_CURRENT_SITE', 1 );

Once you’re ready to reattempt the installation, the following should be set in wp-config.php

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'yourdomain.ext' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

Ideally, yourdomain.ext should be setup without the www. attached (as shown in the example above).

For the .htaccess file, try:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Add Trailing / to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]