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

2. In Your /domains/domain.com/public_html 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 http://domain.com to https://domain.com.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Resellers: How to create custom nameservers

If you have a reseller account you might like to have your own nameservers for your customer's...

How to Create Reseller or Master Reseller in DirectAdmin with DAreseller?

To change a Package as Reseller/Master Reseller Package follow these instructions Go to...

How to create an email account in DirectAdmin?

DirectAdmin is a hosting control panel for Linux server. Please perform the following steps to...

How to host a domain in DirectAdmin?

DirectAdmin is a hosting control panel for Linux server. Please perform the following steps to...

How to create an FTP account in DirectAdmin?

  Perform the following steps to create an FTP Account in DirectAdmin control panel: Login to...