How to set HSTS headers in functions.php

In cases where .htaccess changes is not possibleĀ and there’s a WordPress in use the HSTS headers can be set using the following function: // HSTS Headers add_action( ‘send_headers’, ‘mo_strict_transport_security’ ); function mo_strict_transport_security() { header( ‘Strict-Transport-Security: max-age=15552001; includeSubDomains; preload’ ); } … Read More

How to set HSTS headers with .htaccess

There are more “degrees” of HSTS and the headers can be defined in .htaccess as follows: 1 – Just set the HSTS headers and max-age as standard requires: Header always set Strict-Transport-Security “max-age=31536000”   2 – Add the HTTPS environment … Read More

0