httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Clark <>
Subject [users@httpd] Redirecting http traffic to an https virtual host
Date Mon, 20 Dec 2004 14:59:06 GMT
    I have been reassured by the documentation that this is an easy problem, 
but for some reason I'm not having much luck. I'm running Apache 2.0.52 on 
Debian Sarge, and I want to use Squirrelmail with SSL. No problems running 
Squirrelmail at https://webmail.mydomain.tld. But what I want is for all 
requests to http://webmail.mydomain.tld to be redirected to https://. Here's 
where I run into trouble. /etc/apache2/httpd.conf has the line 
"NameVirtualHost" and I have the virtual domain for 
webmail.mydomain.tld stored in /etc/apache2/sites-available/webmail:
<Directory /var/www/webmail>
  php_flag register_globals off
  Options Indexes FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php

# users will prefer a simple URL like
<VirtualHost webmail.mydomain.tld:443>
  SSLEngine on
  SSLCertificateFile /etc/ssl/mydomain.tld/Cert.pem
  SSLCertificateKeyFile /etc/ssl/mydomain.tld/PrivateKey.pem
  DocumentRoot /var/www/webmail
  ServerName webmail.mydomain.tld
  ServerAdmin postmaster@mydomain.tld

<VirtualHost webmail.mydomain.tld:80>
  ServerName webmail.mydomain.tld
  Redirect permanent / https://webmail.mydomain.tld
    If I have /etc/apache2/sites-available/webmail set up like this, I get the 
following error when trying to start Apache:
Starting web server: Apache2[Mon Dec 20 14:44:46 2004] [error] VirtualHost 
webmail.mydomain.tld:80-- mixing * ports and non-* ports with a 
NameVirtualHost address is not supported, proceeding with undefined results
[Mon Dec 20 14:44:46 2004] [error] VirtualHost webmail.mydomain.tld:443 -- 
mixing * ports and non-* ports with a NameVirtualHost address is not 
supported, proceeding with undefined results  
However, if I comment out the "<VirtualHost webmail.mydomain.tld:80>" and 
following lines, and change "<VirtualHost webmail.mydomain.tld:443>" to 
"<VirtualHost webmail.mydomain.tld>", traffic to http://webmail.mydomain.tld 
isn't redirected.
    I also tried putting an .htaccess file in /var/www/webmail (which is a 
symbolic link to /usr/share/squirrelmail, Squirrelmail's home directory) with 
the following contents:
DirectoryIndex index.php

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{SERVER_PORT}      !^443$
        RewriteRule ^(.*)$      https://%{SERVER_NAME}/webmail/$1 [L,R=303]
But still traffic isn't redirected. I've checked that mod_rewrite is enabled. 
So what obvious thing am I missing?

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message