Last active
May 30, 2017 09:21
-
-
Save robingi/c06004bb66a54eed7775b86b45d00150 to your computer and use it in GitHub Desktop.
Non https and non www redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Non https and non www redirect | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- html --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = document.URL; | |
var splitByDot = url.split('.'); | |
var splitBySlash = url.split('//'); | |
if(url.indexOf('https') === -1 && url.indexOf('www') === -1) { | |
if(!splitByDot[2]) { | |
// www einsetzen falls nicht vorhanden und keine subdomain ist | |
url = 'https://www.' + splitBySlash[1]; | |
} else { | |
// falls www oder subdomain vorhanden, nur https vorsetzen | |
url = 'https://' + splitBySlash[1]; | |
} | |
} | |
// window.location = url; // weiterleitung zur richtigen url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"separate","fontsize":"100","seethrough":"","codespector_bootstrap":"","codespector_jquery":"","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment