Do you want to come to Andalu-SEO?
Andalu-SEO

Different versions of a website. HTTPS and WWW

Choose the correct version of a website in terms of HTTP/HTTPS and WWW/non-WWW and ensure its proper implementation

Different versions of a website. HTTPS and WWW
Author:
Carlos Sánchez
Topics:
servers
Publication Date:
2026-01-12

Last Review:
2026-01-12

Every website, once it has a domain and hosting, has 4 versions (as long as an SSL is used).

A website can use HTTP or HTTPS, which in the case of SEO does have some impact, and it is recommended to always use HTTPS—especially since with Let’s Encrypt it is completely free.
As for whether to use or not to use WWW, it has no impact at all on web positioning. However, you must choose one of the two options.

So, to make it more visual, we have these 4 possibilities within a website. The recommendation is to use HTTPS, and whether to use WWW or not is a subjective decision and a matter of preference that must be made in any project:

The most accepted options in the SEO world would be either of the two at the bottom. That is, with HTTPS

Once a decision has been made, it is not enough to just decide or think about it, you must implement the appropriate configurations for that purpose.

Google Search Console and Bing Webmaster

Unlike other URL changes, today Google Search Console does not recommend using the change of address tool for this purpose. And Bing Webmaster removed its change of address tool in 2021. It no longer appears either in the documentation or in the tool, despite the fact that this tool was launched in 2013.

I recommend verifying the options through Search Console, in case there is any possible error (so it can be detected). And also performing domain-wide verification whenever possible.

This will help us monitor whether any error appears at some point. However, the important implementation in these cases is redirects.

Redirects

Redirects are vital for an optimal configuration in this case. Remember that only one of those 4 options should be valid in order to avoid a duplicate page.

In addition, these redirects must be done correctly and be clean redirects. Having a chain of 2 redirects here can cause even more serious problems in the future.

Redirect chain from a page with HTTP and WWW to a page with HTTPS and WWW, ending at the final page with HTTPS and no WWW.
Tool used: Redirect Path

To avoid these chains, we must ensure that both types of redirects point directly to the correct URL version.

Any other combination where all URLs do not point to the same version would not be correct.

Regarding the million-dollar question: how do you do it?

IMPORTANT NOTE: It is possible that your hosting provider, or your web service graphical interface (such as cPanel or Plesk), is already generating some of these redirects. It is important to check this before implementing anything, and I always recommend testing all implementations in a safe testing/staging environment.

Protocol and WWW redirects in Apache

Before carrying out this task, we must be clear about which version will be the valid one. For example, HTTPS with WWW.

To understand this implementation, you need to understand that Apache handles redirects in a linear way, from top to bottom.

These redirects are somewhat special, and the link redirector will not work for this task.

So we need to go to the very top of our .htaccess file and start with the redirects.

Before the redirects, since we are using mod_rewrite.c, we must have RewriteEngine On set or it will not work.

HTTP redirect

With this code, we detect that if HTTPS is disabled, it redirects with a rewrite rule to the correct HTTPS version. Here we must be clear that if we use WWW, we must include WWW, and if we do not use it, we must not include it, to avoid the redirect chain shown in the previous image.

Remember that at the SEO level, it is always recommended to use HTTPS.

Redirect from HTTP to HTTPS:

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.example.com/$1 [R=301,L,QSA]
</IfModule>

Redirect from HTTPS to HTTP:

In some cases, for some reason, a website may not use SSL or HTTPS. In this case, taking into account the same characteristics as in the previous example, the code would be as follows:
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} on
RewriteRule (.*) http://www.example.com/$1 [R=301,L,QSA]
</IfModule>

WWW redirect

In this case, there is no SEO option that is better than another, so one version or the other should be used based purely on preference.

I recommend placing these codes after the previous ones, and redirecting to HTTP or HTTPS depending on what we have chosen.

Redirect from non-WWW to WWW


<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule (.*) https://www.example.com/$1 [R=301,L,QSA]
</IfModule>

Redirect from WWW to non-WWW:

On the other hand, if what we want is for the WWW version not to exist, it would be done in the opposite way:
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule (.*) https://example.com/$1 [R=301,L,QSA]
</IfModule>

Not understanding this?
If you need help with the more technical aspects, book a consultancy session with me: Get real SEO help!

Trailing slash (/)

Whether a page ends with a trailing slash (/) or not is also a differentiating characteristic. Officially, pages can end in either format. Frameworks or CMSs usually choose one by default, or the server does it.

However, that is not always the case, and duplicate content can occur. In addition to using a self-canonical, the ideal solution is to use a redirect.

If you want to implement a redirect to solve this problem, you have two options.

Remember to change www.example.com to the actual domain

Redirect versions without a trailing slash to the version with a trailing slash

Apache

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule (.*) https://www.example.com/$1/ [R=301,L,QSA]
</IfModule>

Nginx

location / {
rewrite ^(/.*)$ $1/ permanent;
}

Redirect versions with a trailing slash to the version without a trailing slash

Apache

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ https://www.example.com/$1 [R=301,L,QSA]
</IfModule>

nginx

location / {
rewrite ^/(.*)/$ https://www.example.com/$1 permanent;
}

Be careful not to generate different content

It can happen that if there is no control over slashes, or over the page itself, two identical URLs end up being generated, competing for the same search intent.

In addition, in the example shown, it is even more serious because a canonical is not even selected. This would be an example of bad practice and can generate problems.

different pages where the URL only varies by the slash

File extension

Sometimes URLs can also be named according to the language extension they are running on, such as .html, .php, .asp, and many others. This practice does not really affect SEO, as long as a single version is maintained as the correct one.

To avoid making the URL longer than necessary and not to provide irrelevant information to the average user, extensions are usually hidden and the file extension in the URL is redirected, since visually the URL looks cleaner.

Bibliography

If you like this article, you would help me a lot by sharing my content:
Interested in Advanced SEO Training?

I currently offer advanced SEO training in Spanish. Would you like me to create an English version? Let me know!

Tell me you're interested
You might be interested in other articles:
SEO Articles

If you liked this post, you can always show your appreciation by liking this LinkedIn post about this same article.

Usamos cookies para asegurar que te damos la mejor experiencia en nuestra web. Aquí tienes nuestra política de Cookies.