Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Digiover
Last active January 15, 2022 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Digiover/4c2c5d0bc49b2f50e4fa95ed684b4a55 to your computer and use it in GitHub Desktop.
Save Digiover/4c2c5d0bc49b2f50e4fa95ed684b4a55 to your computer and use it in GitHub Desktop.
Add HSTS to WordPress using a send_headers action
<?php
/*
* https://www.saotn.org/enable-http-strict-transport-security-hsts-on-iis/
* follow me on Twitter: @Jan_Reilink
*/
add_action( 'send_headers', 'saotn_add_hsts_header' );
function saotn_add_hsts_header() {
header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment