Knowledge Base

How to redirect domain from HTTP to HTTPS in DirectAdmin?

1. I assume that You already enabled SSL certificate for Your website, for example Let's Encrypt (how to do it You can check HERE).

2. In Your /domains/ directory create a file named .htaccess, if there is already such a file, edit it and add below code on top of the file.

3. Edit it and paste code:

RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

4. Save it and upload to server

Thats all, Your webite should redirect now all requests from to

Please rate this article to help us improve our Knowledge Base.

2 0