Orange is my favorite color

We have a web-based IMAP client running in a subdirectory on our mail server and I wanted to force all usage to be protected by SSL. Google turned up a lot of hits but none of them worked out of the box. Here’s the mod_rewrite snippet which is inside of a <VirtualHost> block:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^/your_directory/(.*)$ https://your.domain.com/your_directory/$1 [R,L]

The (.*) on line 3 tells Apache to take everything until the end of the line (denoted by $) and store it in variable $1 which we then append to the end of our secure URL. Restart Apache and all requests to /your_directory/ will be redirected to a secure, SSL-encrypted URL beginning with https://.

1 Comment

  1. Orange is my favorite color » Blog Archive » End-to-end Thunderbird and Lightning synchronization said:

    on November 5, 2006 at 9:18 pm

    [...] I personally have PHP-based SquirrelMail installed on our mail server and access it via SSL. [...]

{ RSS feed for comments on this post}