To WWW or Not to WWW? How to Add WWW to Your URLs in WordPress

Katie Terrell Hanna
Pressing Words
Published in
5 min readFeb 19, 2019

There are a number of reasons you might need to change the URL of your WordPress site. Changes to the brand typically prompt updates to the domain name. The securing of a website will require a switch from http to https. Then, of course, there’s the matter of updating a website from www to a naked (non-www) URL.

In the following tutorial, I’ll explain why you might want to add www to your URLs in WordPress and provide you with a couple methods for doing so.

Reasons to Use WWW

At first glance, it might not seem like there’s a whole bunch of difference between the Zapier non-www URL:

And the Salesforce www URL:

Both are located on an encrypted connection (as evidenced by the https:// prefix). And they both use a clear and concise .com domain name.

However, there is a reason why one of those websites uses www and the other does not.

Larger websites that contain subdomains must use www. Ultimately, it boils down to how the visitors’ browsers handle cookies.

With www, browsers store cookies for the website as a whole, including all subdomains.

Without www, browsers have to store a different cookie for every subdomain request. As you can imagine, the process is highly inefficient and slows down loading times on the website as a result.

Aside from that one (very good) reason, the difference between www and non-www is superficial.

How to Add WWW in WordPress

For those who would like to add www to your WordPress website–regardless of whether it’s for a site with multiple subdomains–there are a couple of ways to do this.

Just be careful. One wrong move and you could end up with the white screen of death. It might be a simple to execute the change from non-www to www, but it will have far-reaching effects on your website. It will change:

  • The web address on the frontend for visitors.
  • The login URL for you and other WordPress users’ backend access.
  • The functioning of internal and external links pointing to the website.

Before adding www in WordPress, read the following instructions thoroughly.

1. Add WWW in the WordPress Admin

From the WordPress dashboard, visit General Settings. On this screen, you’ll need to update these two fields:

Add www. after “https://” and hit Save Changes.

WordPress should instantly log you out at this time. If it doesn’t, you’ll want to do this on your own.

To log back in, enter your admin URL into the browser window. This time, however, add www. to it.

If you can’t log in after doing this, you need to refresh the server cache. If you continue to experience issues, use the next option.

2. Add WWW with the wp-config.php File

If you want to hard-code the domain name change into the website, use the wp-config.php file to do so.

Visit your control panel and open your file manager or FTP manager. Then, locate the wp-config.php file and add the following lines of code:

define( 'WP_HOME', 'https://www.better-businesses-etc.com' );
define( 'WP_SITEURL', 'https://www.better-businesses-etc' );

Just remember to replace better-businesses-etc.com with your domain name. When you’re done, save your changes.

One quick thing to note:

The wp-config.php settings will always override the domain name settings in the WordPress dashboard. If you experienced issues trying to add www in WordPress and clearing the cache didn’t work, it’s probably because someone already hard-coded the non-www URL into this file. Do a search for the lines above and edit them to reflect the domain name structure you need them to be.

Why You Should Implement a 301 Redirect

If you’re wondering, “Why don’t I just create a version of my website at www and one at non-www? Wouldn’t that be easier?”

Here’s the thing:

It’s not ideal to have both a www and non-www version of a website in existence. There are a couple of reasons for this.

To start, Google indexes website content and associates it with the full URL. If you launched your WordPress site with a non-www domain and then decide a year down the line you want to change it, Google will have to index the www version of it from scratch and you’ll lose all that good link juice you accumulated.

Creating a www mirror image of the non-www website would pose problems in SEO as well. Google bots don’t understand that you’re doing this for the purposes of capturing any and all traffic that goes to the www or the non-www of your website. Google bots will see this and try to rank both versions of the site simultaneously. So, not only will your content compete against itself, but it’ll suffer a penalty for listing duplicate content in search.

Bottom line: you should choose whether to add www to your WordPress site or just leave it out altogether. But make a choice and stick to it.

Then, when you’ve committed to your URL, set up a 301 redirect.

Go to your domain manager and configure a 301 redirect to push traffic from the non-www:

https://better-businesses-etc.localhost

To the www URL:

https://better-businesses-etc.localhost

This ensures you capture all web traffic looking for your brand who might stumble on the wrong or older version of your URL.

Final Thoughts

To www or not to www? That was the question here today.

As you have learned, there are clear reasons why large websites with subdomains should use www. For everyone else, the choice is yours to make. If you like how it looks, or you want to be 100% sure that people who know your brand name can find you, go ahead and add www to your WordPress site. Just make sure you follow the steps above to ensure it’s properly implemented.

Originally published at pagely.com.

--

--

Katie Terrell Hanna
Pressing Words

Digital Marketing Strategist & WordPress 4 Moms Teacher