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
- How HTTPS redirection works
- How to set up redirection on Webhosting
- Common Problems
- Frequently Asked Questions
When to use this guide
- The redirect set up in the domain administration does not work when a visitor enters an address with HTTPS, or Chrome opens the page via HTTPS (The redirect from the domain administration does not work over HTTPS).
- The browser reports an error for an HTTPS address, the page does not respond or has an invalid certificate (Redirection with HTTPS).
- You have a domain only for redirecting to another website and you want it to work over both HTTP and HTTPS (Setting Up Redirection on Webhosting).
- After setup, the redirect works for some visitors and not for others, for example only with www entered (The redirect works only for some visitors).
- The TOO MANY REDIRECTS error is displayed (TOO MANY REDIRECTS).
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:
- The domain you want to redirect is set as the name or Webhosting alias.
- The Webhosting directory structure uses rules for different alias websites (multihosting).
- The domain points in DNS to the hosting that redirects it. If you use WEDOS DNS, you can have it pointed automatically when you set up the alias; otherwise you must set up DNS manually. You can find the IP addresses of the services in the guides DNS – A and AAAA Records.
- On the given Webhosting, you use the default .htaccess file. If you do not, follow the chapter Non-Default .htaccess.
- If you want to redirect via HTTPS, also make sure that you have a Let’s Encrypt certificate activated on the Webhosting for the redirected domain, as described in the guide Webhosting – Manual HTTPS Setup.
Then follow these steps:
- Log in to the Webhosting FTP as described in the guide FTP – Login.
- Go to the folder www/domains.
- Create a new directory named after the domain you want to redirect.
- In this directory, create a new file named .htaccess (including the dot at the beginning).
- 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.

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 error
- The redirect from the domain administration does not work over HTTPS
- The redirect works only for some visitors
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.