How to Set a Preferred Domain (The Easy Way)

Filip Čačić

Filip Čačić

Www Note Hanging


In this article, you’re going to learn why and how you should set up your preferred domain and make sure everything is working correctly.

The process is plain and simple. However, it can feel quite intimidating, given it can be done in many ways. But worry not! We’re here to save the day.

Without further ado, let’s jump into it!

WWW vs. non-WWW

The evergreen SEO topic. Which one should you choose? 

For most websites, there is no difference. It’s all up to your personal preference. One thing you need to worry about though – once you have made a decision, make sure that you stay consistent with your links. 

For example, whenever you’re building backlinks, updating your profile on social networks, or just linking your page to someone – always use the right (preferred) version. 

Even if you have set up redirects correctly, your page will take more time to load if you use a non-preferred version. And, as expected, loading times have a great impact on the user experience. 

Imagine you were standing in a line at a bank for quite some time, just to be redirected to another counter (the right one). We want to avoid situations like that, right? 

Why do you even need to set up a preferred domain?

When you set your preferred domain, you’re basically telling Google which domain you want to be crawled and indexed. 

You also need to make sure your redirects (from www to non-www or vice versa) are working properly.

If you don’t, you will have 2 separate versions of the site! Do you know what that means? That’s right – duplicate content

There are various consequences of duplicate content. It harms your SEO performance in many ways and impacts the end-users’ experience. 

It can also deny your link building efforts. Let’s say that:

  • Your non-www version of the site has 30 backlinks
  • Your www version has 15 backlinks

See the difference? By setting up and redirecting to a preferred domain you would have 45 backlinks pointing to one single page and thus have higher domain authority.

With 301 redirects to the preferred domain, you won’t lose links that are pointing to the previous (wrong) domain. The link juice will be carried over to the preferred one. 

How to set a preferred domain

In 2019., Google removed the option to choose a preferred domain in the Google Search console. 

First of all, you need to know if you even need to do anything. 

These steps apply to everyone:

  1. who wants to have a different URL than the one they have now
  2. whose site is shown in both www and non-www version

Before you do anything, make sure you have a backup of your site and full access to the server and database. 

How to set a preferred domain in WordPress:

This way is the easiest one. However, it can go wrong sometimes. In some cases, people can’t access their site after changing the WordPress Address (URL).

  1. Log in to the WordPress Admin dashboard
  2. Go to Settings → General
  3. Replace the old WordPress Address (URL) and Site Address (URL) with the new one

If you can’t access your site after doing this, you must change the settings in your database:

  1. Go to PHPmyadmin
  2. Navigate to the site’s database
  3. Go to options
  4. Change the site URL and the home option value to the new (preferred) domain

301 redirects to the preferred domain

After you set up your preferred domain, you need to check if your site automatically redirects to the preferred version. 

Type both www and non-www URL versions of your site in the address bar of your browser.

If you can still access both the www and the non-www versions, you need to do one more thing. This applies to both WordPress and non-WordPress users.

Once again, make sure that you have a backup of your site and full access to the server and database.

For this to work, you’ll need to have access to the .htaccess file on your server:

  1. Log in to your server
  2. Go to file manager → public_html (WordPress)
  3. Open .htaccess
  4. Paste the following code at the bottom

Force to www:

RewriteCond%{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

Force to non-www:

RewriteCond%{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Extra tip: Migrating a website

If you’re migrating your website, you need to have your database tables updated with the new URL.

People run into all kinds of problems while migrating sites – their images don’t show and/or their site is broken. With this taken care of, everything should work properly – images, links, media files, etc.

Better Search Replace is a great WordPress plugin that takes control of that. You don’t have to have access to the database, and it’s done in a few seconds.

How to update your database tables when migrating a website

  1. Go to Tools → Better Search Replace
  2. Under ‘Search for’ type your old domain
  3. Under ‘Replace with’ type your new domain
  4. Select all database tables
  5. Uncheck ‘Run as dry run’
  6. Click ‘Run Search/Replace’

All the links in your database will be replaced with new ones.


Technical SEO tends to be confusing, especially for beginners. It implies trial and error, hours and hours of learning, and loads of patience. One simple piece of advice – learn and experiment in a safe environment. Be sure to create backups, ask for advice and go through a lot of materials.

Eventually, everything becomes a piece of cake when it’s thoroughly explored.

Related articles

Performance Report In Gsc Adonomy

A Full Guide to Performance Report in Google Search Console

Master the art of analyzing your website's performance with Google Search Console's Performance Report. Get actionable insights and optimize your SEO strategy.

Seo For Wordpress

The Ultimate Guide to WordPress SEO (2023)

Main challenge of SEO is its broadness. It consists of a huge amount of small steps, which must be taken care of one at a time.

How To Set Homepage In Wordpress Cover

How to set your Homepage in WordPress

When you create your WordPress site, your homepage will by default show your latest posts.

Join our ever-growing list of success stories