That implies that you are not hitting the VirtualHost that you expect.
This is the exact configuration I use on one of my servers:
    RewriteEngine On
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Can you look at your access logs and see which VirtualHost you are
accessing?

You can use this log type to help make sure:
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\"
\"%{User-Agent}i\"" vhost_combined

- Y



On Tue, Feb 18, 2014 at 4:27 PM, David Mehler <dave.meh...@gmail.com> wrote:

> 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 webmas...@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 webmas...@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.
>

http://xkcd.com/138/


> Thanks.
> Dave.
>

Reply via email to