HTAccess Forward HTTP to HTTPS

Article 42 in HTACCESS

2020-08-26 01:19:39 from bugfish
HTAccess Forward HTTP to HTTPS
Last Review on: 2021-10-24 02:11:59 | Hits: 350

If you put this in your htaccess, the server will forward all request from HTTP to HTTPS
(with all details after the domain included like get variables)
It will also rewrite all www.yourdomain.de requests to yourdomain.de.
So its not possible to create 2 sessions on the same website.

Replace yourdomain.de with your own domain which is needed.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.de [NC]
RewriteRule ^(.*)$ https://yourdomain.de/$1 [L,R=301]
I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
Currently 3 Upvotes!
captcha image
System - 2021-03-26 22:53:46
We appreciate comments on our site!

This Website is using Session Cookies for Site Functionality and AWStats.