WWW and not WWW

The suffix www has now become obsolete.

In the early years of the internet, it was necessary to type the protocol http:// and the www suffix, but nowadays the vast majority of websites can be reached by just typing the domain name and extension, e.g. cnn.com.

However, for reasons of compatibility with the past, it is necessary to maintain the possibility of reaching a given website even if the www suffix precedes the domain name.

The website administrator must then redirect requests typed in both ways to a single home page, usually the one that appears as cnn.com.

Whether visiting cnn.com or www.cnn.com, it is a good idea to direct the visitor to cnn.com.

Wordpress How to redirect www to not www
Image credit Pete Linforth da Pixabay

To implement this solution on a website developed on a WordPress platform, it is possible to act on various fronts, such as changing the .htaccess file and changing the DNS records or installing a plugin.

The solution that I would personally prefer is to act on the DNS records and specifying only the name of the domain in the general settings of the WordPress.

Let’s start with the latter. Enter the WordPress dashboard, go to Settings and General. Make sure that the WordPress address and website address fields do not contain the www suffix.

At this point we can work on the DNS, usually through the control panel of the hosting provider.

The DNS can be seen, in a very simplified way, as the street directory of the Internet. 

The postman needs our address in order to deliver our mail. The Internet needs an IP number to allow us to visit a particular website. 

The DNS is a kind of list of these IP addresses to which the name of a website is associated.

Within the dns control panel of your hosting provider there should already be some basic information, which in dns is called a record.

There should be a type A record, i.e. one that announces the IP address of your website to the world.

mysite.com A record —-> 123.123.123.123

You need to insert a new record, of type CNAME, a kind of alias.

www.mysite.com is a CNAME for mysite.com.

This specifies to DNS that anyone wanting to reach www.mysite.com will be redirected to mysite.com.