Last active
          September 20, 2017 23:30 
        
      - 
      
- 
        Save wpscholar/1394310 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