Changeset 1775494
- Timestamp:
- 11/26/2017 11:35:13 AM (8 years ago)
- Location:
- wp-ssl-redirect/tags/1.3.2
- Files:
-
- 2 edited
- 1 copied
-
. (copied) (copied from wp-ssl-redirect/trunk) (1 prop)
-
readme.txt (modified) (2 diffs)
-
wp-ssl-redirect.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-ssl-redirect/tags/1.3.2
-
Property
svn:ignore
set to
sftp-config.json
-
Property
svn:ignore
set to
-
wp-ssl-redirect/tags/1.3.2/readme.txt
r1727222 r1775494 4 4 Requires at least: 3.95 5 5 Tested up to: 4.8.1 6 Stable tag: 1.3. 16 Stable tag: 1.3.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 == 1.3.1 == 36 36 * A minor bug fix regarding query vars 37 == 1.3.2 == 38 * Fixed a major bug related to sub-directory installations -
wp-ssl-redirect/tags/1.3.2/wp-ssl-redirect.php
r1727222 r1775494 4 4 * Plugin Name: WP SSL Redirect 5 5 * Description: A very tiny plugin to force SSL on WordPress websites (via 301 redirects for SEO purpose). 6 * Version: 1.3. 16 * Version: 1.3.2 7 7 * Author: Rehmat Alam 8 8 * Author URI: https://supportivehands.net/ … … 26 26 <h3>WP SSL Redirect Options</h3> 27 27 <hr> 28 <?php 29 if(is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) {?> 30 <div class="notice notice-error"> 31 <p>All In One SEO Pack is known to create issues with WP SSL Redirect so WP SSL Redirect's features will not work unless you will deactivate <strong>All In One SEO Pack</strong> first.</p> 32 </div> 33 <?php }?> 34 <?php 35 if(is_plugin_active('wordpress-seo/wp-seo.php')) {?> 36 <div class="notice notice-error"> 37 <p>Yoast SEO is known to create issues with WP SSL Redirect so WP SSL Redirect's features will not work unless you will deactivate <strong>Yoast SEO</strong> first.</p> 38 </div> 39 <?php }?> 28 40 <form action="options.php" method="post"> 29 41 … … 59 71 60 72 function do_the_ssl_redirect() { 61 $wpsslredir_requested_url = site_url().$_SERVER['REQUEST_URI']; 62 $wpsslredir_parse_url = parse_url($wpsslredir_requested_url); 63 if(get_option('wp_ssl_redirect_protocol') == 'www') { 64 if(strpos($wpsslredir_parse_url['host'], 'www.') === false) { 65 $wpsslredir_parse_url['host'] = 'www.'.$wpsslredir_parse_url['host']; 73 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 74 if(!is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) { 75 $request_uri = $_SERVER['REQUEST_URI']; 76 $requested_full = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 77 $wpsslredir_main_url = site_url(); 78 $wpssl_parsed = parse_url($wpsslredir_main_url); 79 $wpsslredir_requested_url = rtrim($wpsslredir_main_url, '/').str_replace($wpssl_parsed['path'], '', $request_uri); 80 if(get_option('wp_ssl_redirect_protocol') == 'www') { 81 if(strpos($wpsslredir_main_url, '//www.') === false) { 82 $wpsslredir_main_url = str_replace('//', '//www.', $wpsslredir_main_url); 83 } 84 } else if(get_option('wp_ssl_redirect_protocol') == 'non-www') { 85 if(strpos($wpsslredir_main_url, '//www.') !== false) { 86 $wpsslredir_main_url = str_replace('//www.', '//', $wpsslredir_main_url); 87 } 66 88 } 67 } else if(get_option('wp_ssl_redirect_protocol') == 'non-www') { 68 if(strpos($wpsslredir_parse_url['host'], 'www.') !== false) { 69 $wpsslredir_parse_url['host'] = str_replace('www.', '', $wpsslredir_parse_url['host']); 89 90 $wpsslredir_url = str_replace('http://', 'https://', $wpsslredir_requested_url); 91 $wpsslredir_new_siteurl = str_replace('http://', 'https://', $wpsslredir_main_url); 92 if($wpsslredir_new_siteurl !== site_url()) { 93 if(home_url() === site_url()) { 94 update_option('siteurl', $wpsslredir_new_siteurl); 95 update_option('home', $wpsslredir_new_siteurl); 96 } 70 97 } 71 } else { 72 $wpssl_site_default_url = parse_url(site_url()); 73 $wpsslredir_parse_url['host'] = $wpssl_site_default_url['host']; 74 } 75 $wpsslredir_parse_url['path'] = $_SERVER['REQUEST_URI']; 76 $wpsslredir_url = 'https://'.$wpsslredir_parse_url['host'].$wpsslredir_parse_url['path']; 77 $wpsslredir_new_siteurl = 'https://'.$wpsslredir_parse_url['host']; 78 if($wpsslredir_new_siteurl !== site_url()) { 79 update_option('siteurl', $wpsslredir_new_siteurl); 80 update_option('home', $wpsslredir_new_siteurl); 81 } 82 if($wpsslredir_requested_url !== $wpsslredir_url) { 83 header('Location: '.$wpsslredir_url, true, 301); 84 exit; 98 99 if($requested_full !== $wpsslredir_url) { 100 header('Location: '.$wpsslredir_url, true, 301); 101 exit; 102 } 85 103 } 86 104 }
Note: See TracChangeset
for help on using the changeset viewer.