Created
June 10, 2015 16:47
-
-
Save fideloper/8bc66ce0102fdc98f030 to your computer and use it in GitHub Desktop.
Apache redirect http to https
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
<VirtualHost *:80> | |
ServerName site.example.com | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
</IfModule> | |
</VirtualHost> | |
<VirtualHost *:443> | |
ServerName site.example.com | |
ServerAdmin [email protected] | |
DocumentRoot "/opt/local/apache2/sites/site.example.com" | |
DirectoryIndex index.html index.php | |
CustomLog /opt/local/apache2/logs/access_log combinedvhost | |
ErrorLog /opt/local/apache2/logs/error_log | |
<IfModule mod_ssl.c> | |
SSLEngine On | |
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM" | |
SSLProtocol -ALL +TLSv1 | |
SSLProxyEngine On | |
SSLCertificateFile "...removed..." | |
SSLCertificateKeyFile "...removed..." | |
SSLCertificateChainFile "...removed..." | |
SSLProxyProtocol -ALL +TLSv1 | |
SSLProxyCheckPeerCN off | |
#SSLProxyCheckPeerName off | |
</IfModule> | |
<Directory "/opt/local/apache2/sites/site.example.com"> | |
Options All -Indexes -ExecCGI -Includes +MultiViews | |
Order allow,deny | |
Allow from all | |
AllowOverride None | |
<IfModule mod_dav.c> | |
DAV Off | |
</IfModule> | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We hope this post helped you to find out How to Redirect HTTP to HTTPS in Apache
https://www.mstvlife.com/how-to-redirect-http-to-https-in-apache/