0

Given this rule (that strips www from urls for http):

< IfModule mod_rewrite.c >
   RewriteCond %{HTTPS} !=on
   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
   RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</ IfModule >

how do I configure the rewrite to work for https as well?

nillls
  • 625
  • 4
  • 11

1 Answers1

0

A simple search found this:

# remove www from host
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]

Note: the [L] directive may be redundant in your case if it's not the [L]ast rule applied...

Community
  • 1
  • 1
Mike Hudson
  • 1,180
  • 5
  • 13