No More www on

After much thought, I have finally removed all traces of www from 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 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.

  1. Backup your WordPress database. (Never alter the database without a fresh backup on hand.)
  2. Download and install Fraise.
  3. Go to Settings/General in your WordPress admin panel and remove www. from the two URL values.
  4. Export your WordPress database with phpMyAdmin.
  5. Open the .sql file in Fraise.
  6. Navigate to Edit/Find/Advanced Find & Replace, then find and replace all occurrences of “www.yourdomain” with “yourdomain”.
  7. Save the file and quit Fraise.
  8. Return to your WordPress database via phpMyAdmin.
  9. Check all of the tables and choose “Drop” from the pull-down menu.
  10. Navigate to the Import tab, choose your edited .sql file, and click the Go button.
  11. Access your WordPress admin panel.
  12. Re-save your permalink structure at Settings/Permalinks in the admin panel.
  13. Re-save your upload directory at Settings/Miscellaneous in the admin panel.
  14. 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!

2 responses

  1. 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.

    1. Whoops, I knew I forgot something. Thanks for reminding me!