today I checked my domain Divi Sensei in Google PageSpeed Insights and I get a listed a problem "Avoid landing page redirects":

enter image description here

On my site, I run a WordPress multisite, which uses subdomains for the multi sites. The reason is that when I first installed the multisite, I was running the site for quiet some time already and this was the only option was was allowed to select at installation time.

Today I first noticed that the www. is always removed and the page is redirected to non-www. I'm trying to get some more points in PageSpeed Insights so I'd like to remove the redirect but I can't figure out what I need to do to do this.

I tried changing define('DOMAIN_CURRENT_SITE', 'www.divi-sensei.com'); to include the www but this only causes the problem that I cant access the network admin area anymore as there is now a www in it and I get a ERR_TOO_MANY_REDIRECTS error. The main page still redirects me to the non-www version though.

My hoster is All-Inkl and I'm wondering if I need to setup a redirection there. On the other hand, the non-www version with the base URL is the only one I cannot change in the network admin area under Sites (which makes sense, I guess?):

enter image description here

So yeah, the question is: how can I get rid of the redirect from www to non-www

The bonus question is: how can I redirect non-existing subdomains (e. g. test.divi-sensei.com) to the www version? I tried define('NOBLOGREDIRECT', 'divi-sensei.com'); with no luck. I only get 404 Not Found.

Update As suggested in the comments, I checked my .htaccess and found the following rewrite rules. These are exactly the rules WordPress tells you to add for the multi site installation:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
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]
  • Have you checked your .htaccess file (assuming you using an apache server)? This is where I believe the redirect should be set up for a base redirect of www to non-www. – Clinton Jul 24 '18 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.