
: How to remove www from both http and https I've got an ecommerce site where we're have some reports (random) of the cart not operating correctly. I think it might be due to removing www not
I've got an ecommerce site where we're have some reports (random) of the cart not operating correctly. I think it might be due to removing www not working with https
my current htaccess code looks like this:
# remove the www
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ domain.com/ [R=301,L]
What do I need to do to also force this on https?
More posts by @Cugini213
1 Comments
Sorted by latest first Latest Oldest Best
This looks like the same situation covered here: stackoverflow.com/questions/3634101/url-rewriting-for-different-protocols-in-htaccess
Here is the code for removing the www from your hosts, regardless of http or https protocol
RewriteCond %{HTTP_HOST} ^www.
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www.)?(.+)$
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.