httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mehler <dave.meh...@gmail.com>
Subject [users@httpd] Redirecting virtual host to https in Apache 2.4
Date Tue, 18 Feb 2014 21:27:14 GMT
Hello,

I'm running Apache 2.4 on an FC20 box. It's running several name based
virtual hosts.

I've set up one name based virtual host on port 443 I'll call it
webmail.example.com. When a user goes to https://webmail.example.com
the connection encrypts, the page is displayed. Here's the original
version of that virtual host:

<VirtualHost webmail.example.com:443>
     ServerAdmin webmaster@example.com
     ServerName webmail.example.com
 ServerAlias webmail.example.com
     DocumentRoot /srv/http/webmail
     ErrorLog "/var/log/httpd/webmail.example.com_error_log"
     CustomLog "/var/log/httpd/webmail.example.com_access_log" common
SSLEngine on
SSLCipherSuite HIGH
SSLCertificateFile "/etc/ssl/certs/server.crt"
SSLCertificateKeyFile "/etc/ssl/private/server.key"
<Directory /srv/http/webmail>
Options FollowSymLinks
AllowOverRide Limit
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>

My problem is I'm wanting a rewrite rule that will redirect any users
who just go to:

http://webmail.example.com

to:

https://webmail.example.com

so they'll hit the ssl enabled virtual host. I'm getting page not
founds. Here's my configuration:

<VirtualHost webmail.example.com:80>
     ServerAdmin webmaster@example.com
     ServerName webmail.example.com
    ServerAlias webmail.example.com
     DocumentRoot /srv/http/webmail
     ErrorLog "/var/log/httpd/webmail.example.com_error_log"
     CustomLog "/var/log/httpd/webmail.example.com_access_log" common
# I've tried all this:
#    Redirect / https://webmail.example.com/
#    Redirect http://webmail.example.com/ https://webmail.example.com/
  #RewriteEngine  on
  #RewriteCond    %{HTTPS} !=on
  #RewriteRule (.*) https://%{HTTP_HOST}
  #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

Pointers welcome.

Thanks.
Dave.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message