WordPress Multisite Error non-www redirects to registration master site
-
I wanted to post this for the benefit of others – I researched this for hours and found no real answer to my problem and even my host took 3 attempts to spot the problem!
I have a wordpress multisite setup with subdomains but using “custom domains” – all the relevant and up to date guides say just create a new site with any old URL and save, and then go and edit the URL with your desired custom domain name. I pointed all my domains correctly with DNS and added them to my hosts platform (Cloudways). All worked well, at least so I thought!
It turns out the non-WWW version on my custom subdomain sites were pointing back to the registration page of the main site url – they were not redirecting to the relevant WWW version of my site.
There is no need for plugins to do this since latest WordPress has native domain mapping installed. Note my custom domains were added as www. domains but apparently this was no issues, despite mixed information online about this.
RESOLUTION.
I had to add additional code to my .htaccess file AND MOST IMPORTANTLY, in the right position. Adding the additional lines at the bottom of the wordpress code DID NOT WORK!
I had to add the below code; I couldn’t see that any multisite setup guides online mention this requirement, despite calling themselves the “ultimate” guides…
RewriteEngine on RewriteCond %{HTTP_HOST} ^interexautomotive.com [NC] RewriteRule ^(.*)$ https://www.interexautomotive.com/$1 [L,R=301,NC]
And as mentioned, the important was the position of the code and so I show you here my working resolution.
#End of expires headers configuration # BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteEngine on RewriteCond %{HTTP_HOST} ^interexautomotive.com [NC] RewriteRule ^(.*)$ https://www.interexautomotive.com/$1 [L,R=301,NC] 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] # END WordPress
I hope this helps people in future.
- The topic ‘WordPress Multisite Error non-www redirects to registration master site’ is closed to new replies.