Skip to main content

Force https

Force https

Einer der folgenden Code(-Kombinationen) muss möglichst weit oben in die .htaccess eingepflegt werden, sodass die Domain nur eine „Haupt-URL“ hat:

# VARIANTE 1 - HTTPS - non-WWWW
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
# VARIANTE 2 - HTTPS - WWW
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
## Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ https://steuerberatung-schubert.de/$1 [L,R=301]
# Force trailing slash - ALMARON - XX.XX.202X
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$ 
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>