Created
          April 19, 2017 14:39 
        
      - 
      
- 
        Save seb86/10e211e5221a935bbb17d8ef1475b8b0 to your computer and use it in GitHub Desktop. 
    Generic htaccess redirect www to non-www
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | RewriteCond %{HTTPS} off | |
| RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
| RewriteRule ^(.*)$ http://%1/$1 [R=301,L] | |
| RewriteCond %{HTTPS} on | |
| RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
| RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Or you could try this one.
RewriteEngine on RewriteCond %{HTTP_HOST} ^www\. RewriteCond %{HTTPS}s ^on(s)|offs RewriteRule ^ http%1://example.com%{REQUEST_URI} [NE,L,R]