1
votes

I want to use one SSL certificate for www and for non-www traffic. Therefore, I want to redirect all traffic from www to non-www. (Certificate is for non-www).

The following Rule redirect from non-www to www. But I need the oposite. https://www.example.com to https://example.com

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

Thank you

1

1 Answers

0
votes

If you already know the domain name this should work:

RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]