Enable HSTS
By enabling HSTS, you ensure that your website is only accessible via the https protocol. This makes your website even more secure and only accessible with an encrypted connection.
Enabling HSTS via DirectAdmin
- Log in to DirectAdmin and go to Account Manager > Domains
- Click on the respective domain name for which you want to enable HSTS
- Check "Enable HTTP strict transport security".
- Also choose a validity period, under "Max-age for HSTS header", for example 1 year
Enabling HSTS via the .htaccess file
- Check if you have an .htaccess file. If you don't have one yet, you can create it in the public_html folder.
- Open the .htaccess file and add the following line:
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
Note that this only activates HSTS for the specific domain.
If you also want to include subdomains immediately, you can use the following code:Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
- Save the changes.
It may take some time for the settings to take effect, and don't forget to clear your cache.
Still have questions? Get in touch.