Last active
January 7, 2020 18:45
-
-
Save refactorsaurusrex/6b7d86cb2b7374e3a8b7b55517d1ecce to your computer and use it in GitHub Desktop.
How to simultaneously 1) redirect http to https AND 2) remove 'www', if it exists, using an htaccess file
This file contains 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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ http://example.com%{REQUEST_URI} [R=301] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment