We (y’know, over at illuminea) have a client’s site that is using WWW in their domain. Let’s say that domain is, hmm… www.domain.com. And their site is multisite, so that they can easily manage an English and Hebrew website.
The network admin area of the multisite wasn’t working – it created a redirect loop when I went to: http://www.domain.com/wp-admin/network
Some things I tried:
- Removing the WWW from the DOMAIN_CURRENT_SITE in wp-config
I read on the support forums that removing the WWW from the DOMAIN_CURRENT_SITE in wp-config to fix the issue, BUT when I did that, something weird happened: all the internal pages (Ex. http://www.domain.com/about) on the English site redirected to the homepage (posts were fine, and all links on the Hebrew site were fine). Well, I didn’t want things to be wonky on the front-end, so I left WWW in the wp-config file. - Changing and re-saving the permalink structure to /postname/
But it didn’t help.
Here’s what it looks like:
The wp-config.php:
1 |
define('DOMAIN_CURRENT_SITE', 'www.mydomain.com'); |
The .htaccess where I have the regular multisite stuff + a redirect from non-www urls to www urls:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<code>RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash 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]</code> |
The Solution: wp_blogs!
With so many tables in multisite that kind of seem to be doing the same thing (a wp_options for each site within the multisite, wp_site, wp_blogs), we weren’t sure which one would be the magic place to add WWW. As it turns out, the answer was to add WWW to the url in “domain” in the wp_blogs table!
Here’s a screenshot:
Out of curiosity, has anyone else ever run into this issue?