Non-www to www redirections using .htaccess file rules

Enter the following code lines in the .htaccess file and all the search engine bots and users will be redirected to the www address.

RewriteEngine On
RewriteCond %{HTTP_HOST}^nenad.blog [NC]
RewriteRule ^(.*)$ https://www.nenad.blog/$1 [L,R=301]

The rule says: if HOST NAME starts without www, then apply a rule that permanently redirects the address to the www version.

Of course instead of nenad.blog input your domain name.

Why exactly to the www version?

First, the domain name on your business card is probably written with www. If I call you now and ask for the address of the site, you will say: "Double-u, double-u, double-u..." and not "H, T, T, P, colon, forward slash...".

WWW or. "dub, dub, dub," is something people are used to. People are also used to linking to www. If you have an old domain, be sure to check the link profile, it is very likely that you have significantly more links to www than non-www pages.

Redirections downgrade an SEO values. Not completely, but there is still a damp. So it is better to keep the website on www, and apply redirections to a smaller number of non-www incoming links.

But see this, my link profile has more non-www links

If your site is so special to have more non-www links, and people know you as non-www domain, then I acknowledge defeat and suggest that you apply www to non-www redirection.

RewriteEngine On
RewriteCond %{HTTP_HOST}^www\.nenad\.blog [NC]
RewriteRule ^(.*)$ http://nenad\.blog/$1 [L,R=301]

Whatever redirect you are applying, you help Goole to consolidate the duplicate content and to deal with just one version of the site. Another small SEO win!