1

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

1 Answers1

2

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]
Croises
  • 18,570
  • 4
  • 30
  • 47