Global https and non www not in htaccess

stapuff106

Member
Aug 4, 2017
17
1
3
Chicago
cPanel Access Level
Root Administrator
In Home »Service Configuration »Apache Configuration »Include Editor

Under Pre Main Include I select All Versions, which gives me Global input

I added the following which redirects all to https.
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
I added the following to go from www to non-www, but is does not work.
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]
</IfModule>
The net of this is I want all traffic sent to https and non-www for all the domains on the server.

Any suggestions,

Thanks stapuff106