One more try to get the base url define correct.
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 19 Jan 2015 17:03:51 +0000 (12:03 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 19 Jan 2015 17:03:51 +0000 (12:03 -0500)
index.php

index 90cf4af..c70a5ec 100644 (file)
--- a/index.php
+++ b/index.php
  *
  */
 
+// Determine current http/https protocol
+$pageProtocol = 'http';
+if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
+    $pageProtocol = 'https';
+}
+define('GLM_MEMBERS_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+
 // Debug Options
 define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true);
 define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', true);
@@ -58,11 +65,8 @@ define('GLM_MEMBERS_PLUGIN_DB_VERSION', 0.1);
 
 // URLs
 define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__));
-$pageProtocol = 'http';
-if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
-    $pageProtocol = 'https';
-}
-define('GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL', $pageProtocol.'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
+$pageUri = explode('?', $_SERVER['REQUEST_URI']);               // Bust this up to access URL path and script name only
+define('GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL', $pageProtocol.'://'.$_SERVER['SERVER_NAME'].$pageUri[0]);
 
 // Directories
 define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database');