Web Hosting - Domain Redirection with HTTPS

This article deals with domain redirection using .htaccess file on Webhosting. If you do not have a Webhost, follow the instructions in the Domains - Basic Redirection article.

In this article you will read:


Redirection with HTTPS

The following procedure takes advantage of the ability to generate an SSL certificate for any domain or subdomain within the basic HTTPS setup of the web host or its alias.

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


Redirection settings on Webhosting

Before you set up a redirect on your Web Host, make sure that:

Then follow these steps:

  1. Log in to the FTP web hosting by following the FTP - Login instructions.
  2. Go to the www/domains folder.
  3. Create a new directory with the name of the domain you want to redirect.
  4. In this directory, create a new file called .htaccess (including the period at the beginning).
  5. Insert the code into the newly created .htaccess file:
RewriteEngine On
RewriteRule(.*) https://novadomena.tld/ [R=301,L]

Rewrite the text novadomena.tld in the code to the address where you are redirecting the domain. Then save the code.

Sample redirect settings via .htaccess file
Sample redirect settings via .htaccess file

Redirection via Webhosting should work immediately after saving the .htaccess file. If it does not, run a test in an anonymous browser window.

Other than the default .htaccess

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

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

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

Edit the second line of code to the domain you are redirecting. Place a \ before each dot of the domain name. 

Edit the third line of code to the address where you are redirecting the domain.


Common problems

Common problems with redirection include:

TOO MANY REDIRECTS

Problem: Instead of the redirected site, I get a TOO MANY REDIRECTS error.

Cause: a loop occurred during redirection. Most often you cause it 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 don't have Webhosting?

You can use domain redirection as described in Domains - Basic Redirection, where HTTPS can be provided by the WEDOS Protection add-on service.

Did the instructions help you?

Thank you for your feedback!
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors