Knowledge Base›Webhosting›Domain Redirect with HTTPS

Webhosting – Domain Redirect with HTTPS

On this pageWhen to use this guideRedirection with HTTPSSetting Up Redirection on WebhostingCommon ProblemsFrequently Asked Questions

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

In this article you will learn:


When to use this guide


Redirection with HTTPS

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

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

A simple redirect set up in the domain administration does not work with HTTPS. To redirect HTTPS as well, the domain must point to a webhosting with an issued certificate, and you set up the redirect in the .htaccess file as described in this article.


Setting Up Redirection on Webhosting

Before you set up redirection on Webhosting, make sure that:

Then follow these steps:

  1. Log in to the Webhosting FTP as described in the guide FTP – Login.
  2. Go to the folder www/domains.
  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. Paste the following code into the newly created .htaccess file:
RewriteEngine On
RewriteRule (.*) https://newdomain.tld/ [R=301,L]

Text newdomain.tld in the code with the address you want to redirect the domain to. Then save the code.

Sample redirection setup using the .htaccess file
Sample redirection setup using the .htaccess file

If the conditions are met, redirection via Webhosting should work immediately after you save the .htaccess file. If it does not, test it in a private browser window.

Non-Default .htaccess

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

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

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

Edit the second line of the code to the domain you are redirecting. Place the character below before every dot in the domain name: \. 

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


Common Problems

Common redirection problems include:

TOO MANY REDIRECTS

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

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

Solution: Make sure that 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://newdomain.tld/$1 [R=301,L]

The redirect from the domain administration does not work over HTTPS

Problem: The domain has a redirect set up in the administration. The HTTP address works, but the HTTPS address does not respond, or the browser (especially Chrome) opens it over HTTPS by itself and the redirect is not performed.

Cause: The domain’s redirect server does not support HTTPS. In addition, the domain points to the redirect server rather than to a webhosting with a certificate.

Solution: Point the domain to a webhosting (or set it up as an alias there), issue a Let’s Encrypt certificate for it and set up the redirect in the .htaccess file according to the chapter Setting Up Redirection on Webhosting. Without a webhosting, use HTTPS redirection via WEDOS Protection.

The redirect works only for some visitors

Problem: After setup, some people see the redirect correctly, while others get an unavailable page (for example only with the address without www).

Cause: The browser or DNS has an old version of the page stored.

Solution: Load the page without cache using the keyboard shortcut Ctrl+Shift+R, clear the browser cache, or open the website in an incognito window or another browser. You cannot influence visitors’ cache, and it cannot be configured on the domain’s redirect server. It is more reliable to redirect via .htaccess on webhosting, where you can set how long the cache is kept.


Frequently Asked Questions

What if I don’t have Webhosting?

You can use redirection from the domain as described in the guide Domains – Basic Redirection, 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 your own 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 the form ⧉. Specify the WebSite service name and the target domain.

After I set up webhosting, the domain redirect set up in the domain administration stopped working. How do I redirect it now?

Via the .htaccess file on the webhosting. The domain must point to the webhosting and have a Let’s Encrypt certificate issued; the procedure is in the chapter Setting Up Redirection on Webhosting. The redirect then works over both HTTP and HTTPS.

What happens if I do not have a certificate for the redirected domain?

The redirect works only over HTTP and the HTTPS address ends with an error. Add the domain to the certificate following the guide Webhosting – Manual HTTPS Setup.

Was this article helpful?

Your feedback helps us improve our articles.

Your message goes to the documentation team, who do not reply to it. If you need help, contact us using the contact form. Do not include passwords or personal data.

Didn't find what you were looking for?

Ask other customers on the Help community website.