0

I have purchased a ssl certificate recently and have redirected all my traffic on secured https way but i want to get included in hsts preload list. For that reason i want to include hsts header. Is there any way using .htaccess or httpd.conf or if there is another way then please tell me in detail

pnuts
  • 58,317
  • 11
  • 87
  • 139
Punit Makwana
  • 485
  • 1
  • 6
  • 13

2 Answers2

2

you can set the hsts header in a .htaccess file:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS

@see How to set HSTS header from .htaccess only on HTTPS for more information

or with php:

header('Strict-Transport-Security: max-age=63072000; includeSubdomains; preload');
Simon
  • 324
  • 1
  • 13
0

Also you can put HSTS header on application side, I mean PHP. Add following code top of your header.php or index.php

<?php header("strict-transport-security: max-age=600");

People who uses shared hosting does not have an access to apache.conf. So proper way to do this is putting it on apache.conf.

Mehmet Ince
  • 1,298
  • 9
  • 20