Multisite fresh install uses 302 Redirect, where standard install uses 301. Why?
-
Hi folks,
I’m attempting to create a multisite network for the first time, because I felt this was more sensible than maintaining 5 separate installations with roughly the same set of plugins, themes etc..
Perhaps I will change my mind though, because I stumbled over redirect issues.
A clean install of wordpress, out of the box, no customization, no multisite, when the main domain is https://www.example.com, will perform a 301 redirect from example.com to https://www.example.com, when the URL is set to https://www.example.com in WordPress.
I checked this with a redirect tracer at wheregoes.com.
Just put a clean install of WordPress 5.5.3 on my directory, linked the database as you should, and observed the 301 redirect to the “www.” subdomain, as expected. Works like a charm, as it does on all my installations.
Now all I did convert this installation to Multisite, and added NOTHING.
By this I mean addin the lines/* Multisite */ define( 'WP_ALLOW_MULTISITE', true );
to wp-config.php and then followed the installation routine.
The result:
The exact same site, just because it now has multisite capability, suddenly performs a 302 redirect from example.com to https://www.example.com.I will now test whether the same behaviour is true for a main site on example.com and redirect from https://www.example.com. Will be back to this thread in about 5 minutes.
– File directory removed
– Database entries dropped
– WordPress installation pack unzipped
– Installation performed
– settings/general removed the www. subdomain from the URL in WordPress address and site address.
– Saved changes
– Traced redirects
Result: example.com is not redirected, https://www.example.com is redirected 301 to example.comNow:
– Add two lines to wp-config for multisite
– checked the redirect, still 301, just checking.
– tools/network setup, chose subdirectory install, click install.
– checked the redirect, still 301, just checking.
– Added the code to wp-config (still 301 redirect)
– Added the code to .htaccess (still 301 redirect)
– Logged on.Still applying a 301 redirect from https://www.example.com to example.com
So apparently the behaviour is different, depending whether the main site uses the www. subdomain or not.When I perform this exact procedure again but leave the main domain at https://www.example.com, then this happens:
– Clean install wordpress 5.5.3
– Add two lines to wp-config for multisite
– checked the redirect, still 301, just checking.
– tools/network setup, chose subdirectory install, click install.
– checked the redirect, still 301, just checking.
– Added the code to wp-config
– checked the redirect, this is now a 302 redirect!!
– Added the code to .htaccess (still 302 redirect)
– Logged on.I face a number of additional problems when I add sites to the network and change the url to TLD’s but as long as the main site already uses a type of redirection which is penalized by google, I see no point tackling any further problems.
Now I have two questions:
1. WHY ???
2. Can this be changed to 301 redirect always?Thanks for any input, which I will appreciate.
- The topic ‘Multisite fresh install uses 302 Redirect, where standard install uses 301. Why?’ is closed to new replies.