]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Fix for wrong SERVER_NAME usage (may cause trouble)
[mailer.git] / inc / filters.php
index a4adfd44d64b46814d4b826f9896ab43d131a060..ecfa95f2698085585572c575bb5853e39f468f35 100644 (file)
@@ -1316,5 +1316,17 @@ function FILTER_HANDLE_REFERRER_BANNER_VIEW ($filterData) {
        }
 }
 
+// Filter for redirecting on wrong server name (e.g. bad.your-server.tld will be redirected to your-server.tld)
+function FILTER_REDIRECT_WRONG_SERVER_NAME ($filterData) {
+       // Is the configured URL same as SERVER_NAME?
+       if (extractHostnameFromUrl(getUrl()) != detectServerName()) {
+               // Then redirect to configured URL
+               redirectToRequestUri();
+       } // END - if
+
+       // Return filter data
+       return $filterData;
+}
+
 // [EOF]
 ?>