^

Generic HTACCESS Forces SSL & Non-WWW

Article 141 in HTACCESS

2021-08-01 07:59:02 from bugfish
Generic HTACCESS Forces SSL & Non-WWW
HTACCESS
Last Review on: 2021-09-19 10:48:21 | Hits: 59

This is the code for an .htaccess file which does:

-> Redirect all www requests to non-www requests
-> Always force SSL

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

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 0 Upvotes!
captcha image
System - 2021-08-01 07:59:06
We appreciate comments on our site!

Theme
14/12
This Website is using Session Cookies for Site Functionality and AWStats.