If you’ve used the multisite option on WordPress 3.0 and greater, you’ll notice that you may have your ‘www’ stripped from your main blog root domain. Supposedly, WordPress 3.0 was supposed to automatically handle your ‘www’ if you had specified it properly when you made the initial installation.
But what about the rest of us who neglected to do so? It’s an easily overlooked step, and fortunately it’s easily correctable… if you’re willing to brave through digging your MySQL database and editing one line PHP code. With pre-WP 3.0 blogs you were able to specify the main site URL, but that option is gone in 3.0. So what you’ll need to do is dig around in your WordPress database and modify your
We’ll take it one at a time.
Launch your myphpadmin panel and navigate to your WordPress database. Inside, there will be two tables you’ll need to modify:
wp_options. Alternatively, you could run a text string search for ‘mydomain.com’ through the myphpadmin interface and get those tables to appear.
Browse the table
wp_blogs by clicking on it and click on the pencil icon next to edit the field of the root domain that you wish to change.
This will bring up a window to edit the field, you should see ‘mydomain.com’. Simply replace that with ‘www.mydomain.com’ as specified here.
Do the same for the
wp_options table, editing the
home entries in the table. Make similar changes, replacing any instance of http://mydomain.com with http://www.mydomain.com. Then to be thorough–though I believe I didn’t do this on a few other installations and it still worked fine–be sure to make similar modifications in the
wp_usermeta tables as well. There are maybe only 4 more entries total there to which you need to add a ‘www.’
You’re in the home stretch now. Close myphpadmin and edit your
wp-config.php file in the root directory of your WordPress installation folder. Modify the line:
define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' );
define( 'DOMAIN_CURRENT_SITE', 'www.mydomain.com' );
and you’re done! You’ll probably have to re-login to your dashboard, but it should show the ‘www’ in the URL this time.
This fix requires no fussing with the .htaccess file. I tried this originally with just making the changes in the WordPress MySQL database only, but I ended up getting a “The page isn’t redirecting properly” error in Firefox. It turns out I was missing one critical modification in
wp-config.php, which I’ve pointed out above.
Hopefully that solved any headaches for you and allowed you to add ‘www’ in your root domain of your multisite WordPress installation.