Divi WordPress Theme

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.


  1. The problem isn’t one of should have it or shouldn’t have it. The problem is when a server only accepts connects with or without it. The server should be accepting connections in both cases and many of the cases in the forums, the server would only accept a connection with the ‘www’ and would drop the connection without the ‘www.’

    That’s when it’s incorrect.

  2. Hey I could need some help. I tried to use WPMU 2.6 with www.

    First I tried the way you described, edited the tables with my domainname in it and commented out the two lines in wpmu-settings. But when I tried to logout I could and was always redirected to the admin panel.

    So I tried the way you linked with a new install. Commented out the two lines in wpmu-settings.php and commented out lines 238, 239, 365, 366, 451 and 487 from index-install.php and then installed with http://www.domain.tdl. But after this the loginform looked as though all css infos got lost and when I tried to login I was redirected from http://www.domain.tdl/blogs/wp-login.php to the nonexistent address http: //blogs/wp-login.php (without the space between p and /).

    And now I’m stuck…

  3. I found out that the logout problem does only occur in the first login after the change without having restart the browser or emtied the cache (dunno whether this will change it)

  4. please please please… I’ve spent two days looking for a solution for this.
    I’ve a WPMU version 2.5 installed using subdomain.
    Your advice does not work with my configuration… any advice will help..
    I really like the fact you don’t cry about standards or other stuff.. pragmatic approach is mine too!

  5. hey andrea,

    Your suggestion seems working , but as i am noob with phpmyadmin, i use search and replace plugin to replace domain to add www.

    It works also, in my admin panel , it is showing with www but site is still loading with non www

    It would be nice if you can tell how to replace domain with http://www.domain with phpmyadmin


  6. hey andrea,

    I think , I hit the bulls eye, I have re-install with your tips but it didn’t work, after that i delete wp-config.php file to re-install ( only setup re-install )

    One thing i do is edit index-install.php as same code you mention is also there, comment out those two lines and re-setup

    And now my site loading with www


  7. I’ve managed to get this working on 2.7 – it’s much the same as your two steps, but with one extra step (and I think only required after you’ve logged in once, although I’m not sure).

    You need to edit /wp-config.php – there’s a reference to your domain without the “www” in there (line 39), that needs updating with “www.”. I needed to download, delete, edit and upload the file – it was locked by whatever user created it.

    This is on a folder setup, not sub-domain.


  8. […] Bestetik, gure kasuan blogetarako ez genituen azpi domeinuak baimendu nahi. Blog bakoitza azpi-karpeta batean egotea nahi genuen. WordPress-mu instalatzean aukera hau eskaintzen da, baina berez eta ezer galdetu barik instalatzaileak domeinuaren aurreko www delakoa desagerrarazten du. Guretzako beharrezkoa da www domeinuan izatea, ziurtagiriak http://www.ehu.es domeinurako prestatuta dauzkagulako. Honetarako ondorengo artikuluan datozen argibideak jarraitu genituen: Forcing MU to use www […]

  9. On a second note, apparently I can’t login anymore on the mapped domain.

    newdomain.com is mapped to new.maindomain.com, all works smoothly. Unfortunately, when I try to login on newdomain.com/wp-admin/ I’m stuck in a redirect to the login page. Because I edited the blog’s domain settings as well I can no longer login to new.maindomain.com/wp-admin/ either

    The only thing I can do now is login to maindomain.com (the wpmu root) and edit stuff as admin, but I want to have users that can only access newdomain.com so I can’t allow them to login at the root..

    what to do?

  10. Here’s how I did this for subdomains (NOT tested on subfolder style), WP 3.0-alpha w/multi site enabled. This adds www to your main site, but doesn’t touch subdomains.

    Add the “www” to “domain” & “site url” settings of the main blog (Network -> Sites -> Edit). I then added the following to my .htaccess: (let’s see how code shows up in the comments)

    #redirect to www for the main site
    RewriteCond %{HTTP_HOST} ^domain.com
    RewriteRule ^ http://www.domain.com%{REQUEST_URI} [L,R=301]

    Obviously change “domain” to your domain. Again, I ONLY tested this on subdomains, and it worked good.

      • Right, but if you try going to www after enabling your site it trys to take you to the bog registration form. Plus all the admin emails don’t include the www regardless of your site URL settings, so it is quite annoying unless you include those lines in your .htaccess

        • Yep.

          But now you can install it with the www from the start. When this post was written, you could not. MU woudl strip out the www regardless of what was done.

          in 3.0 it’s all been fixed.

    • I tried this, however in the 3.01 WPMU I go to Super Admin > Sites> Edit (for the main domain) and it will not let me edit the domain or site URL. Is this the correct location or where else should I make the change.

      I have the .htaccess setup.

      • This post is no longer relevant for 3.x. It will allow the www as long as that’s the main domain you installed on. (as opposed to using the non-www version)

          • WordPress will respond to the www. (as did MU). If you want to force it on the www then change your site & home URL to www before installing the network. If you force it on the www, a WordPress network won’t respond to the non-www URL.