Pavel Tashev
Pavel Tashev / Entrepreneur and Software Developer
Constantly learning new things. I love to be part of projects and StartUps that inspire me and improve the life of society.
Contact me via LinkedIn
Isle of Man, UK and Bulgaria
How to Redirect a non-WWW to WWW URL in WordPress?

How to Redirect a non-WWW to WWW URL in WordPress?

Today I will review an issue which I have encountered many times during my work with WordPress. The issue concerns the case when we install WordPress for first time and we want to change the non-WWW URL to WWW URL. For example:


There are cases when after this change, you will no longer be able to access your website through or If you have that issue and you don’t know how to fix it, here are the things which you must consider:

  1. The web service (Apache, NGINX or else) must be configured correctly.
  2. The access rights to the directories and the files corresponding to the WordPress installation must be the right ones because when the web service tries to access a file or to update something, it must be able to do it.
  3. WordPress must be with the right configurations.

If all requirements above are fulfilled, we must check one more thing – the DNS records of the domain name.

Every time when we hit, the request will be sent to the nearest DNS server which will find out that the request must be forwarded to the IP address of the server where we host the website. Let’s mark that IP with IP_ADDRESS_OF_THE_HOST_MACHINE. But there might be cases when your DNS record miss something very important, they miss the configuration for the situation when somebody requests the domain name with WWW – From DNS point of view, this is a different domain name and if there is no record for it, the DNS won’t know where to forward the request. This will lead us to the followins scenario:

  1. We log in to the WordPress administration.
  2. The DNS server works because the requests to are redirected to our hosting machine. That’s why we can log in to the administration, we can edit the content of the website, etc.
  3. The next step is to change the domain name from non-WWW to WWW and save.
  4. That’s the moment when we will encounter an issue because the DNS server doesn’t have a record for the domain name which contains WWW. And also if we try to access the website through, WordPress (because it was said so) will redirect us to This is a closed circle and there is no escape from it.

The solution is very simple actually (which I hope will work and for you). Just go to the administration of your domain name and add the following CNAME record:

Hostname: *
Target Host:

This CNAME record is called a Wildcard record because what it does is to tell the DNS servers to forward all requests to to the IP address associated with the domain name

That issue is not a huge obstacle as you can see, but sometimes you can struggle with it. So bear in mind all things above when you work with WordPress.

That’s from me for now. As always, any feedback in the comments is welcome!

Share me please:

Leave a Reply

16 + three =


Please type the text above: