After much thought, I have finally removed all traces of www from MacManX.com. Why? Aesthetics, really. There’s really no reason to have www preceding your domain, an ever-increasing number of sites are beginning to turn away from it, and it saves four characters when linking to MacManX.com in a tweet.
Removing www from your domain in WordPress is as easy as removing it from the two URL values at Settings/General, but I wanted to be as thorough as possible and remove all traces of it. Since the overall process involved a few steps, I figured that I’d share it with you if you ever decided to do the same.
The following instructions are Mac-specific using the plain text editor Fraise, but they can be easily reinterpreted using any Windows or Linux-based plain text editor and FTP or SFTP client.
- Backup your WordPress database. (Never alter the database without a fresh backup on hand.)
- Download and install Fraise.
- Go to Settings/General in your WordPress admin panel and remove www. from the two URL values.
- Export your WordPress database with phpMyAdmin.
- Open the .sql file in Fraise.
- Navigate to Edit/Find/Advanced Find & Replace, then find and replace all occurrences of “www.yourdomain” with “yourdomain”.
- Save the file and quit Fraise.
- Return to your WordPress database via phpMyAdmin.
- Check all of the tables and choose “Drop” from the pull-down menu.
- Navigate to the Import tab, choose your edited .sql file, and click the Go button.
- Access your WordPress admin panel.
- Re-save your permalink structure at Settings/Permalinks in the admin panel.
- Re-save your upload directory at Settings/Miscellaneous in the admin panel.
- If you have a sitemap plugin, like Google XML Sitemaps, make sure that the sitemap location is still set correctly and refresh your sitemap.
The process should only take a few minutes and everything should be working correctly.
My widgets reset themselves for some reason during the process, but they were easy to add back afterwards. Just take a screenshot of your widget settings and save your text widgets (if any) to a separate text file.
Update: I forgot to mention that WordPress will automatically issue a 301 (permanent) redirect for all incoming links that contain www. Thanks to WordPress core developer Andrew Nacin for reminding me!
I recently did this for my site as well. Worth pointing out that WordPress will automatically do a canonical 301 redirect to non-www links, when a www link is requested, based on your settings.
Whoops, I knew I forgot something. Thanks for reminding me!