Redirecting www to non-www while maintaining the protocol HTTP or HTTPS
问题 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} ^www.example.com$ RewriteRule ^(.*)$ http://example.com/$1 [R=301] RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteCond %{SERVER_PORT} ^443 RewriteRule ^(.*)$ https://example.com/$1 [R=301] This isn't fully working as expected. What happens: Visiting http://www.example.com results in a redirect to http://example.com . This indicates my