--- simple-301-redirects/wp-simple-301-redirects.php	2016-03-01 00:28:16.000000000 -0700
+++ /srv/www/mhsoft/wp-content/plugins/simple-301-redirects/wp-simple-301-redirects.php	2017-10-21 15:06:18.364413326 -0600
@@ -151,10 +151,11 @@
 		 */
 		function expand_redirects() {
 			$redirects = get_option('301_redirects');
 			$output = '';
 			if (!empty($redirects)) {
+				ksort($redirects, SORT_STRING | SORT_FLAG_CASE);
 				foreach ($redirects as $request => $destination) {
 					$output .= '
 					
 					<tr>
 						<td><input type="text" name="301_redirects[request][]" value="'.$request.'" style="width:99%" /></td>
@@ -200,20 +201,28 @@
 			else {
 				delete_option('301_redirects_wildcard');
 			}
 		}
 		
+		function removeScheme($requestURL){
+			$pos=strpos($requestURL,"://");
+			if ($pos>0){
+				$requestURL=substr($requestURL,$pos+3);
+			}
+			return $requestURL;
+		}
+		
 		/**
 		 * redirect function
 		 * Read the list of redirects and if the current page 
 		 * is found in the list, send the visitor on her way
 		 * @access public
 		 * @return void
 		 */
 		function redirect() {
 			// this is what the user asked for (strip out home portion, case insensitive)
-			$userrequest = str_ireplace(get_option('home'),'',$this->get_address());
+			$userrequest = str_ireplace($this->removeScheme(get_option('home')),'',$this->removeScheme($this->get_address()));
 			$userrequest = rtrim($userrequest,'/');
 			
 			$redirects = get_option('301_redirects');
 			if (!empty($redirects)) {
 				
