CS · EN

Webhosting - Domain Redirect with HTTPS

This article covers domain redirection using the .htaccess file on Webhosting. If you do not have Webhosting, follow the instructions in the article Domains – Basic Redirect.

In this article you will learn:


Redirection with HTTPS

The following procedure uses the option to generate an SSL certificate for any domain or subdomain within the basic HTTPS setup on Webhosting or its alias.

The redirection itself is handled by the .htaccess file, which redirects the HTTPS request to the specified address.


Setting up redirection on Webhosting

Before setting up redirection on Webhosting, make sure that:

Then follow these steps:

  1. Log in to the Webhosting FTP according to the instructions FTP – Login.
  2. Go to the www/domains folder.
  3. Create a new directory named after the domain you want to redirect.
  4. In this directory, create a new file named .htaccess (including the dot at the beginning).
  5. Insert the code into the newly created .htaccess file:
RewriteEngine On
RewriteRule (.*) https://novadomena.tld/ [R=301,L]

Replace the text novadomena.tld in the code with the address to which you want to redirect the domain. Then save the code.

Sample redirection setup via the .htaccess file
Sample redirection setup via the .htaccess file

If the conditions are met, redirection via Webhosting should work immediately after saving the .htaccess file. If not, test it in an incognito browser window.

Non-default .htaccess

This procedure may cause website errors on the original Webhosting domain.

If you do not use the default WEDOS .htaccess file in the www folder, insert this code at the beginning of the modified .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?staradomena\.tld$
RewriteRule (.*) https://novadomena.tld/$1 [R=301,L]

Adjust the second line of the code to the domain you are redirecting. Place the character \ before each dot in the domain name. 

Adjust the third line of the code to the address to which you want to redirect the domain.


Common problems

Common redirection problems include:

TOO MANY REDIRECTS

Problem: Instead of the redirected website, the TOO MANY REDIRECTS error is displayed.

Cause: A loop occurred during redirection. It is most often caused by pointing the domain to itself.

Solution: Make sure the address you are redirecting to is different from the original domain.

If the problem persists, try extending the code to:

RewriteEngine On 
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://novadomena.tld/$1 [R=301,L]

Frequently asked questions

What if I do not have Webhosting?

You can use domain redirection according to the instructions Domains – Basic Redirect, where HTTPS can be provided by the WEDOS Protection add-on service.

How do I set up redirection on the WebSite 1.0 service?

On the WebSite service, you can set up redirection by inserting custom JavaScript in the page settings. However, this solution may not behave correctly in all browsers.

If you use a paid WebSite plan and want to use the service only for HTTPS redirection to another domain, request the setup via form ⧉. Specify the WebSite service name and the target domain.