When you have a domain (mysite.com), it comes with a subdomain called www.mysite.com — also known as an alias.
If you’re not sure which one you’re using, it might be a good optimization idea to decide! Technically, it doesn’t matter whether you use one or the other. It’s just a question of what you want to promote for people to use when finding your site.
I always promote my sites with www, but there are benefits to choosing the non-www version, as it’s quicker to type.
That’s why I use these lines in my .htaccess file:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
This way, anyone who types the domain without www gets redirected to www.domain.com.
If you prefer to use the non-www version of your domain, you can use the following instead:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
This way, anyone who types www will be redirected to domain.com.
But remember to replace domain.com with your actual domain name!
The Key Point:
Choose one version and stick to it — then promote it consistently.
That way, users avoid unnecessary redirects, which slow down page load times.
Does it work?
If you’re unsure whether your site is served from minside.dk or www.minside.dk, visit www.webpagetest.org and test both versions.
Check the very first line in the result.
If it’s not a 301 redirect, that’s your actual URL.
If the first line is a 301 redirect, the second line will show the correct domain being used.

0 Comments