Wordpress MU and the www prefix
Nowadays, the www prefix is considered to be a redundant relic. In order to support the no-www initiative, Wordpress MU is by default set up so that the www prefix is stripped from URLs. For example, if one typed in http://www.example.com to access a Wordpress MU installation, they would end up at http://example.com.
Now, for some reason it might be the case that you do want the www to remain (I don’t mind having the www stripped, but from my experiences with installing Wordpress MU for clients, it is often the case that they want the www prefix to remain). However, this is apparently not a straightforward thing to achieve in Wordpress MU.
This issue has received a bit of coverage:
http://mu.wordpress.org/forums/topic.php?id=8012
http://mu.wordpress.org/forums/topic.php?id=5765
http://mu.wordpress.org/forums/topic.php?id=5752
Suggestions offered in order to retain the www involve hacking the core code and editing the .htaccess file. I looked briefly into these but without much success.
Fortunately, in my tinkering with the back-end administration, I stumbled across a way to achieve this with some manipulation of the database. If you want to know what to do without reading about how I discovered this trick, skip to the last paragraph.
Say the blog is location at http://example.com. To begin with, start at Site Admin->Blogs and go to edit the blog. The key lies in editing the ‘Siteurl’ and ‘Home’ fields under Blog Options. It is to these URL values that the www should be added. Problem is, when you add the www and click on ‘Update Options’, the change does not last. This is because, if you look at the ‘Domain’ field at the top of the ‘Edit Blog’ page under the ‘Blog info’ section, it will have something like [http://]example.com. The value in this field seems to go towards dictating the value of ‘Siteurl’ and ‘Home’. So I tried to add a www to this value but this resulted in a big problem; I could no longer access the site. My browser could not load the page, warning me that there was some infinite redirection loop issue.
So I went into the database with phpMyAdmin, and removed the www from the relevant entry in the table ‘wp_blogs’. I then realised though that I could manually edit the ‘Siteurl’ and ‘Home’ blog options by editing the relevant entries in the database table ‘wp_1_options’.
So, in short, to prevent the www prefix from being removed from a Wordpress MU blog URL, go to the ‘wp_X_options’ table, where ‘X’ is the ID of the blog, and edit the ’siteurl’ and ‘home’ fields by adding the www.
Tags: Wordpress MU, www prefix

















































