Mobile app version of vmapp.org
Login or Join
Cugini213

: 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

@Cugini213

Posted in: #Htaccess

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cugini213

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

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]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme