Forcing MU to use www
Please note: version 3.x and above WILL allow you to use the www. No hacks or workarounds are needed.
By default, Mu strips out the www on domain names. I’m not going to get into the debate of for or against, because at some point you just may be forced to use it for reasons beyond your immediate control. Whether you like it or not. 😀
In case you somehow missed catching the the change in the address bar, symptoms may include a redirect error when trying to view the main page, even if it installed fine, and a constant page refresh when trying to login. So watch the address bar and see if it’s adding the www.
After a few eye-bleeding hours searching the forums and the forum tags, I finally found it here. (Did you know there’s actually two ways to search? I should probably write a post on that…)
The thread is a year old and the line numbers are slightly off, but most of it still applies. The rewrite rule to strip www is no longer in the htaccess file so don’t bang your head looking for it. 😀
In my case, I did not want to reinstall again because of the setup it was more work. Here’s what I did:
– go into phpmyadmin and search for all instances of your domain name. Edit them to add the www to the domain name.
– Find wpmu-setting.php in your root folder. Comment out lines 10 and 11 like this:
// if( substr( $domain, 0, 4 ) == 'www.' )
// $domain = substr( $domain, 4 );
Those double-slashes in front of the lines keep that code from being run.
Go test your install, it should be okay. I should also mention that I only tested this on a subfolder install. I have no idea what it does on subdomains.