Example of redirecting http virtualhost to a https virtualhost

The syntax highlighter puts in =”” after the port number, remove it!



  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]

  
    Options FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
  






  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

  
    Options +FollowSymLinks +Includes +ExecCGI
    AllowOverride All
    Require all granted