title: Mod rewrite issue with https, strip www from url
body: <p>we have a url for eg  <code>https://www.egdomain.com/</code>  and the ssl is valid for egdomain.com. 
  so how can i redirect all the requests from <code>https://www.egdomain.com/</code> to <code>https://egdomain.com/</code></p>
  
  <p>the site also has normal http requests which works fine. </p>
  
  <p>I tried the htaccess below but still nothing</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
  
  RewriteCond %{HTTP_PORT} =443
  
  RewriteRule (.*) https://%1/$1 [L,R=301]
  
  RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
  
  RewriteRule (.*) http://%1/$1 [L,R=301]
  </code></pre>
  
  <p>Any help will e much appreciated</p>