WordPress: Add WWW in front of domain without redirect or .htaccess

When you go to a website, you will find that some of them use “www.” in front of the domain name (example: [highlight color=”pink”]www.kloningspoon.com[/highlight]), and some of them do not. It is very common that both options will take you to the same place on the Internet, or at least the same information. That still does not mean search engines see it the same way as humans.

It is important to know that the domain name (example: [highlight color=”pink”]kloningspoon.com[/highlight]) is the “root domain”. Anything coming before the [highlight color=”pink”]kloningspoon.com[/highlight], such as [highlight color=”silver”]ftp.kloningspoon.com[/highlight], [highlight color=”green”]pop.kloningspoon.com[/highlight], [highlight color=”red”]smtp.kloningspoon.com[/highlight] and etcetera denotes a SUBdomain. Yes, of course, this includes [highlight color=”pink”]www.kloningspoon.com[/highlight], because it is a subdomain, too! An easy way to drive this home is to go to mail.google.com or to www.google.com … they are clearly different.

Now that we understand this point, let’s think of the www and non-www versions as two completely different domains. If somebody links to your website (and let’s hope they will) which one should they be linking to? Using a 301 redirect will actually reflect the correct address in the browser address bar, making it more likely that they will choose the right version when they want to link to your website. That is because before your web server even sent the page to the person visiting your website, it knew which version to send. In the event that somebody gets it wrong, a 301 redirect will tell search engines that the content they linked to is actually at the other location where it should be indexed.

Ok, that is the basic information that you know. So, then you will add the script below to you [highlight color=”salmon”].htaccess[/highlight] for your easy redirect from non www to www of your domain.

# Add a leading www to domain if one is missing.  #
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

But… unfortunately when you check your site with GTmetrix it is still said that you need to [highlight color=”orange”]Avoid landing page redirects[/highlight], from [highlight color=”blue”]https://kloningspoon.com[/highlight] to [highlight color=”pink”]https://www.kloningspoon.com[/highlight]

In wordpress, it is simple way to fix this. You just need to change [highlight color=”orange”]Wordpress Address (URL)[/highlight] and [highlight color=”orange”]Site Adress (URL)[/highlight] with www in front of your domain.

'General-Settings-‹-KLoningSpoon-—-WordPress'

Viola its working like charm and you just no need to modification your [highlight color=”salmon”].htaccess[/highlight].

Artikel terkait:   Add Expires Headers

Isi Komentar

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

− four = 2

This site uses Akismet to reduce spam. Learn how your comment data is processed.