I\'m attempting to redirect www to non-www for both HTTP and HTTPS requests. My root .htaccess looks like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^w
Perhaps you could try the following:
RewriteEngine on
# Check if the host contains "www."
RewriteCond %{HTTP_HOST} ^www\.
# Check if we're using HTTPS
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$
# Redirect accordingly
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]