apache - HTTPS for www and non-www only - HTTP for all subdomains -


i have certificate single domain only, including www. current .htaccess setup, redirecting http requests https. want make following:

  1. force https domain.com (www , non-www)
  2. allow http subdomains *.domain.com

is possible?

my current .htaccess setup forces use https

# force ssl rewritecond %{https} !=on rewriterule ^ https://%{http_host}%{request_uri} [l,r=301] 

i have found 1 solution:

# force https www rewritecond %{https} off rewritecond %{http_host} ^(?:www\.)(domain\.com)$ [nc] rewriterule ^ https://www.%1%{request_uri} [r=301,l]  # force http subdomains rewritecond %{https} on rewritecond %{http_host} ^((?!www).+\.domain\.com)$ [nc] rewriterule ^ http://%1%{request_uri} [r=301,l] 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -