Skip to content

Instantly share code, notes, and snippets.

@apoorva-shah
Created October 26, 2017 05:46
Show Gist options
  • Save apoorva-shah/2cb65a102f133aaeb71aa78ffef9b18d to your computer and use it in GitHub Desktop.
Save apoorva-shah/2cb65a102f133aaeb71aa78ffef9b18d to your computer and use it in GitHub Desktop.
Htaccess help
- Redirect to https and non-www to www
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&cad=rja&uact=8&ved=0ahUKEwjozKHqyo3XAhWENI8KHUSNAvoQFgg9MAQ&url=https%3A%2F%2Fsimonecarletti.com%2Fblog%2F2016%2F08%2Fredirect-domain-http-https-www-apache%2F&usg=AOvVaw3ZrAY62n_uaXWwa7g2eJs5
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment