Example of redirecting http virtualhost to a https virtualhost
The syntax highlighter puts in =”” after the port number, remove it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <VirtualHost *:80> ServerName www.feeditout.com ServerAlias feeditout.com DocumentRoot /var/www/html LogLevel debug CustomLog /var/log/apache/www.feeditout.com-access.log combined ErrorLog /var/log/apache/www.feeditout.com-error.log RewriteEngine On RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L] <Directory /> Options FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:443> ServerName www.feeditout.com ServerAlias feeditout.com DocumentRoot /var/www/html LogLevel debug CustomLog /var/log/apache/www.feeditout.com-access.log combined ErrorLog /var/log/apache/www.feeditout.com-error.log SSLEngine on SSLCertificateFile /somewhere/feeditout.com.crt SSLCertificateKeyFile /somewhere/feeditout.com.key.nopass SSLCertificateChainFile /somewhere/ca.crt RewriteEngine On <Directory /> Options +FollowSymLinks +Includes +ExecCGI AllowOverride All Require all granted </Directory> </VirtualHost> |