Created
May 8, 2015 19:12
-
-
Save schlessera/8d5091c021fb2495b1f6 to your computer and use it in GitHub Desktop.
Revisions
-
schlessera created this gist
May 8, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ # Redirect HTTP to HTTPS, for the main domain as well as all subdomains. # # Example: # http://domain.com/ => https://domain.com/ # http://subdomain.domain.com/ => https://subdomain.domain.com/ # # Make sure you replace "replacewithyourdomain" with your actual root domain! # # @author: Alain Schlesser <alain.schlesser@gmail.com> # The HTTP to HTTPS redirection code needs to go in front of the WordPress code. # Make sure RewriteEngine is on RewriteEngine On # First, redirect HTTP subdomains to HTTPS subdomains RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(.*)\.replacewithyourdomain\.com$ RewriteRule ^(.*)$ https://%1.replacewithyourdomain.com/$1 [R=301,L] # Now, redirect HTTP main domain to HTTPS main domain RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^replacewithyourdomain\.com$ RewriteRule ^(.*)$ https://replacewithyourdomain.com/$1 [R=301,L] # BEGIN WordPress # [Here is your standard WordPress code, you should not modify this.] # END WordPress