- 
      
- 
        Save jimboobrien/56e4c18258a6bbd8b955578562c45801 to your computer and use it in GitHub Desktop. 
    Force SSL on pages in WordPress
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** | |
| * Force SSL on pages in WordPress | |
| */ | |
| function force_ssl(){ | |
| if( !is_ssl() ){ | |
| $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
| wp_redirect( $url, 301); | |
| exit(); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment