Plugin Directory

Changeset 1913238


Ignore:
Timestamp:
07/23/2018 04:32:35 AM (7 years ago)
Author:
rehmatworks
Message:

Updating to v1.4

Location:
wp-ssl-redirect
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • wp-ssl-redirect/tags/1.4/readme.txt

    r1786901 r1913238  
    1919
    2020= Does this plugin make any changes to the file system or database? =
    21 No changes are made to file system but site url (siteurl) and home url (home) is updated in database if necessary.
     21No changes are made to file system or the database.
    2222
    2323= How does WP SSL Redirect perform the redirect? =
    24 The plugin makes use of $_SERVER array to check either the URL is accessed over HTTPS or HTTP. If the request is made over HTTP, then the plugin sends a 301 redirect header and performs the redirect to the HTTPS version of same URL.
     24The plugin makes use of $_SERVER array to check either the URL is accessed over HTTPS or HTTP. If the request is made over HTTP, then the plugin sends a 301 redirect header and performs the redirect to the HTTPS version of the same URL.
    2525
    2626= 301 Redirect is Not Working =
     
    4040== 1.3.2 ==
    4141* Fixed a major bug related to sub-directory installations
     42== 1.4 ==
     43* Rewrote the redirection code to make it even simpler
     44* Disabled the website URL update in the database
  • wp-ssl-redirect/tags/1.4/wp-ssl-redirect.php

    r1786901 r1913238  
    44* Plugin Name: WP SSL Redirect
    55* Description: A very tiny plugin to force SSL on WordPress websites (via 301 redirects for SEO purpose).
    6 * Version: 1.3.2
     6* Version: 1.4
    77* Author: Rehmat Alam
    88* Author URI: https://supportivehands.net/
     
    1010*/
    1111
    12 defined( 'ABSPATH' ) or die(); // Prevents direct access to pluin dir
     12defined( 'ABSPATH' ) or die(); // Prevents direct access to plugin dir
    1313
    1414add_action('admin_menu', function() {
     
    6767  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    6868  if(!is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) {
    69     $request_uri = $_SERVER['REQUEST_URI'];
    70     $requested_full = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    71     $wpsslredir_main_url = site_url();
    72     $wpssl_parsed = parse_url($wpsslredir_main_url);
    73     $wpsslredir_requested_url = rtrim($wpsslredir_main_url, '/').str_replace($wpssl_parsed['path'], '', $request_uri);
     69    $redirectUrl = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
    7470    if(get_option('wp_ssl_redirect_protocol') == 'www') {
    75       if(strpos($wpsslredir_main_url, '//www.') === false) {
    76         $wpsslredir_main_url = str_replace('//', '//www.', $wpsslredir_main_url);
     71      if(strpos($redirectUrl, '//www.') === false) {
     72        $redirectUrl = str_replace('://', '://www.', $redirectUrl);
    7773      }
    7874    } else if(get_option('wp_ssl_redirect_protocol') == 'non-www') {
    79       if(strpos($wpsslredir_main_url, '//www.') !== false) {
    80         $wpsslredir_main_url = str_replace('//www.', '//', $wpsslredir_main_url);
    81       }
    82     }
    83 
    84     $wpsslredir_url = str_replace('http://', 'https://', $wpsslredir_requested_url);
    85     $wpsslredir_new_siteurl = str_replace('http://', 'https://', $wpsslredir_main_url);
    86     if($wpsslredir_new_siteurl !== site_url()) {
    87       if(home_url() === site_url()) {
    88         update_option('siteurl', $wpsslredir_new_siteurl);
    89         update_option('home', $wpsslredir_new_siteurl);
     75      if(strpos($redirectUrl, '//www.') !== false) {
     76        $redirectUrl = str_replace('//www.', '//', $redirectUrl);
    9077      }
    9178    }
    9279   
    93     if($requested_full !== $wpsslredir_url) {
    94       header('Location: '.$wpsslredir_url, true, 301);
     80    if(empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] !== "on") {
     81      header('Location: '.$redirectUrl, true, 301);
    9582      exit;
    9683    }
  • wp-ssl-redirect/trunk/readme.txt

    r1786901 r1913238  
    1919
    2020= Does this plugin make any changes to the file system or database? =
    21 No changes are made to file system but site url (siteurl) and home url (home) is updated in database if necessary.
     21No changes are made to file system or the database.
    2222
    2323= How does WP SSL Redirect perform the redirect? =
    24 The plugin makes use of $_SERVER array to check either the URL is accessed over HTTPS or HTTP. If the request is made over HTTP, then the plugin sends a 301 redirect header and performs the redirect to the HTTPS version of same URL.
     24The plugin makes use of $_SERVER array to check either the URL is accessed over HTTPS or HTTP. If the request is made over HTTP, then the plugin sends a 301 redirect header and performs the redirect to the HTTPS version of the same URL.
    2525
    2626= 301 Redirect is Not Working =
     
    4040== 1.3.2 ==
    4141* Fixed a major bug related to sub-directory installations
     42== 1.4 ==
     43* Rewrote the redirection code to make it even simpler
     44* Disabled the website URL update in the database
  • wp-ssl-redirect/trunk/wp-ssl-redirect.php

    r1786901 r1913238  
    44* Plugin Name: WP SSL Redirect
    55* Description: A very tiny plugin to force SSL on WordPress websites (via 301 redirects for SEO purpose).
    6 * Version: 1.3.2
     6* Version: 1.4
    77* Author: Rehmat Alam
    88* Author URI: https://supportivehands.net/
     
    1010*/
    1111
    12 defined( 'ABSPATH' ) or die(); // Prevents direct access to pluin dir
     12defined( 'ABSPATH' ) or die(); // Prevents direct access to plugin dir
    1313
    1414add_action('admin_menu', function() {
     
    6767  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    6868  if(!is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) {
    69     $request_uri = $_SERVER['REQUEST_URI'];
    70     $requested_full = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    71     $wpsslredir_main_url = site_url();
    72     $wpssl_parsed = parse_url($wpsslredir_main_url);
    73     $wpsslredir_requested_url = rtrim($wpsslredir_main_url, '/').str_replace($wpssl_parsed['path'], '', $request_uri);
     69    $redirectUrl = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
    7470    if(get_option('wp_ssl_redirect_protocol') == 'www') {
    75       if(strpos($wpsslredir_main_url, '//www.') === false) {
    76         $wpsslredir_main_url = str_replace('//', '//www.', $wpsslredir_main_url);
     71      if(strpos($redirectUrl, '//www.') === false) {
     72        $redirectUrl = str_replace('://', '://www.', $redirectUrl);
    7773      }
    7874    } else if(get_option('wp_ssl_redirect_protocol') == 'non-www') {
    79       if(strpos($wpsslredir_main_url, '//www.') !== false) {
    80         $wpsslredir_main_url = str_replace('//www.', '//', $wpsslredir_main_url);
    81       }
    82     }
    83 
    84     $wpsslredir_url = str_replace('http://', 'https://', $wpsslredir_requested_url);
    85     $wpsslredir_new_siteurl = str_replace('http://', 'https://', $wpsslredir_main_url);
    86     if($wpsslredir_new_siteurl !== site_url()) {
    87       if(home_url() === site_url()) {
    88         update_option('siteurl', $wpsslredir_new_siteurl);
    89         update_option('home', $wpsslredir_new_siteurl);
     75      if(strpos($redirectUrl, '//www.') !== false) {
     76        $redirectUrl = str_replace('//www.', '//', $redirectUrl);
    9077      }
    9178    }
    9279   
    93     if($requested_full !== $wpsslredir_url) {
    94       header('Location: '.$wpsslredir_url, true, 301);
     80    if(empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] !== "on") {
     81      header('Location: '.$redirectUrl, true, 301);
    9582      exit;
    9683    }
Note: See TracChangeset for help on using the changeset viewer.