Skip to content

Instantly share code, notes, and snippets.

@danielmcclure
Created September 11, 2014 21:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmcclure/3f5be86daa464cdaa289 to your computer and use it in GitHub Desktop.
Save danielmcclure/3f5be86daa464cdaa289 to your computer and use it in GitHub Desktop.
< ?php
/**
* @package HSTS
* @version 1.0
*/
/*
Plugin Name: HSTS - HTTP Strict Transport Security enforcement plugin
Author: kang@insecure.ws
Version: 1.0
Author URI: https://www.insecure.ws
*/
function hsts_header()
{
isset($_SERVER['HTTPS']) && header('Strict-Transport-Security: max-age=15768000; includeSubDomains');
}
add_action( 'send_headers', 'hsts_header' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment