Why I moved to WWW

After a long time of debating whether or not I should move this site to www.ofthenerds.com, I decided to make the migration a few days ago.


According to WPBeginner:

There are absolutely no SEO benefits of choosing one over another.
So, SEO was NOT a factor in this decision, but there were many others.


One reason to switching to www is actually security. Because www is considered a subdomain, information for that subdomain will not be shared on others. Using a subdomain also allows for the option to restrict cookies to just the www subdomain, and not other subdomains. While this is not currently a problem, should I ever want to use another subdomain for something important, then this will definitely be helpful.


Also, using a www subdomain allows for the DNS record to be a CNAME. While this does not apply to me, if you’re using a tool such as Blogger, then being able to use a CNAME can make the setup process a lot simpler. However, this is not an issue if you’re using CloudFlare, as they will automatically convert the CNAME to an ‘A’ record. But, for people not on CloudFlare, there is also scaling to think about.

Most big sites use www

Here’s a short list of websites that use www:

  • www.google.com
  • www.youtube.com
  • www.facebook.com
  • www.bing.com
  • www.wpbeginner.com
  • www.amazon.com
  • www.ebay.com

It doesn’t really matter

Whichever one you choose, you can always simply redirect the other to. If you’re using Apache, you can just Google the .htaccess rules, but for those of you on NGINX, here are some code snippets that will help with the migration:

non-www to www:

if ( $host = "example.com" ){
    return 302 https://www.example.com$request_uri;

www to non-www

if ( $host = "www.example.com" ){
    return 302 https://example.com$request_uri;

You can use 301 redirects, but this creates a problem if you ever want to switch again. 301 redirects, unless a certain header is sent, will be cached forever, making it impossible to switch domains later on. Also, if you don’t want to mess with the NGINX config, or simply don’t have NGINX, you can always use a CloudFlare page rule. CloudFlare will set the proper header, so even if you do use a 301 redirect, it will expire at some point 🙂 .


If you’re not on a WordPress multisite, you can simply edit the Site URL and Home URL in your settings to the www or non-www version. If you are on a multisite, you can still change that, but if you want to do a complete change, you’ll need to run the following:

sudo mysqldump wp_dbname | sed "s,oldurl,newurl,g" > dump.sql
sudo mysql --execute "DROP DATABASE wp_dbname;CREATE DATABASE wp_dbname"
sudo mysql wp_dbname < dump.sql

And you’ll also need to change the following line in your wp-config.php file:

define('DOMAIN_CURRENT_SITE', 'example.com');

Source: WPBeginner

Affiliate disclosure: This post may contain affiliate links. Affiliate links are special links which allow the destination website to know we sent that visit, and will often set a cookie to remember that. Should you then purchase their product/service, we may get a commission. Learn more.

Affiliate link:
%d bloggers like this: