Reputation:
How to redirect all pages to non-www https?
http://example.com/* -> https://example.com/*
http://www.example.com/* -> https://example.com/*
https://www.example.com/* -> https://example.com/*
Thanks
Upvotes: 1
Views: 303
Reputation: 18671
Use:
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
Upvotes: 2