When setting up a WordPress Network (multisite) using subdomains you should avoid using the default ‘www’ sub domain prefix. You are told this when activating the network. There is a good reason for it – mostly that all the good and useful plugins assume that you have done.
I can think of two reasons why you haven’t done this: either you are a little lazy, or you have a well established website (with ‘www’ in it) that you are converting into a network.
Whatever the reason, some time later on, you are looking at your hundreds (or thousands!) of sites and wishing that you could somehow get rid of that pesky ‘www’.
There are 5 database tables and 1 config file for you to edit:
- Update wp-config.php where DOMAIN_CURRENT_SITE is defined.
- Update wp_site.domain (where id=1)
- Update wp_blogs.domain (where site_id=1 blog_id=1)
- Update wp_sitemeta.meta_value (where site_id=1 meta_key=siteurl)
- Update wp_options.option_value (where option_name=siteurl)
- Update wp_options.option_value (where option_name=home)
Depending on your set up, you may need to look further into the options table and post content, but I have successfully updated three networks using the above 6 changes.