https erzwingen | force http to https
Posted: Tue 23. May 2017, 07:13
English below
Hallo zusammen,
hat zwar nicht unbedingt mit CMSimple zu tun, funktioniert jedoch tadellos und vielleicht wollte der eine oder andere diese Funktion schon immer haben.
Ziel war es den Besucher gezielt von http auf https zu lenken, quasi als erzieherische Maßnahme. Generell publiziere ich die Links zu meiner Webseite immer mit https jedoch neigt der User dazu generell den link ohne dem "s" einzugeben.
Hier wird Serverseitig durch den Apache mit Hilfe der .htaccess der User einfach auf die https weitergeleitet.
Dies funktioniert jedoch nur wenn auch ein SSL Zertifikat vorliegt anderweitig kommt ein Zertifikatsfehler auch auf Sub - Seiten ohne Wildcard-Zertifikate wird ein Fehler erscheinen.
Im CMSimple Root einfach in die .htaccess folgenden Code eintragen und yourdomain.tld durch eure Domain ersetzen:
Bitte denkt daran das nach einem Core Update eventuell dieser Eintrag im .htaccess File ersetzt wird .
Hoffe es ist dem einen oder anderen eine Hilfestellung.
Danke und Gruß
Chris
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hello ,
the goal was to force the visitor from http to https . In generally, I publish the links to my website always with https, however, the user generally tends to enter the link without the "s".
Apache supoports the redirection by .htacces file in the CMSimple root .
This will only work if an SSL certificate is present, otherwise a certificate error will appear also on sub-pages without wildcard cert.
In the CMSimple root simply enter the following code into the .htaccess and replace yourdomain.tld with your domain:
Please remember that after a core update possibly this entry in the .htaccess file will be replaced.
Hope this will help someone.
Thanks and regards
Chris
Hallo zusammen,
hat zwar nicht unbedingt mit CMSimple zu tun, funktioniert jedoch tadellos und vielleicht wollte der eine oder andere diese Funktion schon immer haben.
Ziel war es den Besucher gezielt von http auf https zu lenken, quasi als erzieherische Maßnahme. Generell publiziere ich die Links zu meiner Webseite immer mit https jedoch neigt der User dazu generell den link ohne dem "s" einzugeben.
Hier wird Serverseitig durch den Apache mit Hilfe der .htaccess der User einfach auf die https weitergeleitet.
Dies funktioniert jedoch nur wenn auch ein SSL Zertifikat vorliegt anderweitig kommt ein Zertifikatsfehler auch auf Sub - Seiten ohne Wildcard-Zertifikate wird ein Fehler erscheinen.
Im CMSimple Root einfach in die .htaccess folgenden Code eintragen und yourdomain.tld durch eure Domain ersetzen:
Code: Select all
AddDefaultCharset UTF-8
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://yourdomain.tld/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Hoffe es ist dem einen oder anderen eine Hilfestellung.
Danke und Gruß
Chris
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hello ,
the goal was to force the visitor from http to https . In generally, I publish the links to my website always with https, however, the user generally tends to enter the link without the "s".
Apache supoports the redirection by .htacces file in the CMSimple root .
This will only work if an SSL certificate is present, otherwise a certificate error will appear also on sub-pages without wildcard cert.
In the CMSimple root simply enter the following code into the .htaccess and replace yourdomain.tld with your domain:
Code: Select all
AddDefaultCharset UTF-8
RewriteEngine On
RewriteBase /
RewriteCond% {HTTPS}! ^ On $
RewriteRule (. *) https: //yourdomain.tld/$1 [R, L]
RewriteCond% {REQUEST_FILENAME} -s [OR]
RewriteCond% {REQUEST_FILENAME} -l [OR]
RewriteCond% {REQUEST_FILENAME} -d
RewriteRule ^. * $ - [NC, L]
RewriteRule ^. * $ Index.php [NC, L]
Hope this will help someone.
Thanks and regards
Chris