Re: Redirecting virtual host to https in Apache 2.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Must works with this

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Le 18/02/2014 22:27, David Mehler a écrit :
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@xxxxxxxxxxx
     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@xxxxxxxxxxx
     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@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



--
Michel LABARRE
HELICOM
Tel. +33 (0) 1 60 22 73 76
Mob. +33 (0) 6 83 48 65 44

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux