Carlos Williams wrote:
I have a server up and running with Apache 2.2.14-2. Right now in apache my Document Root is set as /srv/http and this takes you to www.mydomain.tld. This is perfect on port 80 but I have a subfolder in my Document Root called 'webmail/'. When I access the webmail subfolder, I want to do this over port 443 (SSL). My question is how do I keep my main site as follows: www.mydomain.tld (http) www.mydomain.tld/webmail (https) Also if someone goes to www.mydomain.tld/webmail on port 80, it redirects to port 443.
I think you'll be better off and less likely to get confused in the script if you break out both HTTP and HTTPS into VirtualHost containers, then add some rewrite rules to handle the redirect. Something like this (bare bones, untested, substitute 1.2.3.4 for your real IP address on the box).
Listen 443 <VirtualHost 1.2.3.4:80> ServerName www.mydomain.tld DocumentRoot /srv/http RewriteEngine on RewriteRule ^/webmail(/?.*) https://www.mydomain.tld/webmail$1 [R,L] </VirtualHost> <VirtualHost 1.2.3.4:443> ServerName www.mydomain.tld DocumentRoot /srv/http SSLEngine on SSLCipherSuite AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5 SSLCertificateFile "/path/to/my/ssl.crt" SSLCertificateKeyFile "/path/to/my/ssl.key" </VirtualHost>If you don't understand the SSL directives, I highly recommend consulting the docs instead of blindly copying and pasting. You can get fancier and also use a rewrite rule to push HTTPS traffic back to HTTP if it doesn't start with /webmail.
-- Justin Pasher --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx