wp-force-ssl
Last commit date
index.php
11 years ago
php-backwards-compatibility.php
7 years ago
plugin.php
7 years ago
readme.txt
6 years ago
wp-force-ssl.php
7 years ago
plugin.php
21 lines
| 1 | <?php |
| 2 | // Prevent direct access to this file. |
| 3 | if( !defined( 'ABSPATH' ) ) { |
| 4 | exit( 'You are not allowed to access this file directly.' ); |
| 5 | } |
| 6 | |
| 7 | // "The Core" |
| 8 | define('FORCE_SSL' , true); |
| 9 | |
| 10 | if (defined('FORCE_SSL')) |
| 11 | add_action('template_redirect', 'wpfssl_core'); |
| 12 | |
| 13 | function wpfssl_core(){ |
| 14 | |
| 15 | if ( FORCE_SSL && !is_ssl () ) |
| 16 | { |
| 17 | wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 ); |
| 18 | exit(); |
| 19 | } |
| 20 | } |
| 21 | ?> |