Force redirect visitors to https
Do you have an SSL certificate on your website? Then you also want all visitors to end up on the secure https version, and no longer on http. Below you can read how to set that up, and what to do if your site stops working afterwards or after a migration.
In DirectAdmin
- Log in to DirectAdmin: in My WebOké, go to My Products and click DirectAdmin next to your hosting package.
- Under Account Manager, click Domain Setup and click your domain name.
- Check that Secure SSL is turned on. Only then will you see the options below.
- Under SSL, turn on the Force SSL with https redirect switch.
- Click Save to save your changes.

You will also find Enable HTTP Strict Transport Security (HSTS) there. On most of our servers, the web server already sends HSTS by default for every website with https, with a max-age of one year. In that case you don't need the switch. You can see whether your site already sends HSTS in the test at internet.nl. Only turn the switch on if your site doesn't send HSTS yet and your certificate works for all names: browsers remember HSTS for a long time, and if the certificate stops working later, visitors will no longer be able to open your site. More information can be found in HSTS and security headers for your website.
On the same page, under Force redirect, you choose whether visitors always go to the address with www or without www.
The redirect from Force SSL with https redirect is permanent (301) and keeps the path: http://yourdomain.com/contact goes to https://yourdomain.com/contact, not to your homepage. This way search engines and old links keep their place. After turning it on, check it with an address that contains a path. If you set it up in a plugin or in .htaccess, make sure that redirect is also a 301 and keeps the path.
Or in your website
Many applications can do it themselves. In WordPress, go to Settings › General and set the WordPress Address and Site Address to https://. Use only one redirect: not in DirectAdmin and in a plugin or in .htaccess at the same time. Otherwise your website may get stuck in a redirect loop.
Is your site no longer working after https or a migration?
Go through these steps in order:
- First try a private window or another browser. Your browser may remember an old page or an old redirect. If it does work there, clear your browser's cache.
- Getting the message 'too many redirects' or 'page isn't redirecting properly'? Then two settings are sending each other back and forth. For example Force SSL and a plugin, a custom rule in
.htaccess, or a different choice for with or without www in DirectAdmin than in WordPress. Turn one of the two off. If you use the Cloudflare proxy with the SSL mode Flexible, choose Full (strict) there instead. More causes can be found in ERR_TOO_MANY_REDIRECTS: too many redirects. - Certificate error or a certificate in the name of the server? After a migration or a DNS change, the certificate often hasn't been issued yet. That can only happen once the domain points to our server, and sometimes takes a few hours. Turn off the https redirect in the meantime and request the certificate as described in Activating an SSL certificate.
- Certificate error without a button to continue anyway? Then your browser has remembered HSTS for your site. You can't skip that message: first make sure you have a working certificate. Visitors who previously opened your site via https can only get back in once the certificate works.
- Do you see a blank or different page on https, with text saying you should put an index.html in private_html? Then private_html is still a separate folder for your domain. Read Message: To change this page, upload a new index.html to your private folder.
Is your entire website unreachable, even without https? Then follow the step-by-step guide My website is unreachable.
Still stuck? Create a ticket with your domain name and the message you see.
See also in the DirectAdmin manual: No padlock or 'not secure': fixing mixed content, Let's Encrypt fails: causes and solutions and Domain settings: SSL, PHP, www and private_html.
Detailed explanation with screenshots: Always sending visitors to https in the DirectAdmin manual.
Want to learn more? Take the free course Getting found online, lesson 4.1 https and a proper redirect.
Want to learn more? Take the free WordPress course, lesson 3.2 www, redirects and mixed content.
