User Tools

Site Tools


webservers:apache-force-https

Force HTTPS and WWW

Put this to .htaccess

#Force https:
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^DOMAIN.TLD [NC]
RewriteRule ^(.*)$ http://www.DOMAIN.TLD/$1 [L,R=301,NC]
webservers/apache-force-https.txt · Last modified: 2018/10/23 17:26 by dreiggy

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki