Roundcube Community Forum

Recycle Bin => Recycle Bin => Topic started by: renevdb on September 16, 2006, 02:31:09 AM

Title: redirection to https
Post by: renevdb on September 16, 2006, 02:31:09 AM
Hi,

JUst want to redirect all traffic in my webmail.domain.com to https and changed the .htaccess but this doesn't work.

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

# AddDefaultCharset   UTF-8
#php_flag    display_errors Off
php_flag    log_errors   On
php_value    error_log    logs/errors
#php_value   upload_max_filesize   2M


 Order allow,deny
 Deny from all


Order deny,allow
Allow from all

What am I missing. I have no access to http.conf so I need to do it in .htaccess.

thanks!!
Title: Re: redirection to https
Post by: ipstatic on September 17, 2006, 12:13:37 AM
I just figured this out myself. I am using this in my httpd.conf but it should work in a .htaccess as well:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

Hope this works!
Title: Re: redirection to https
Post by: renevdb on September 17, 2006, 01:45:48 PM
The rules work, but when used with the other rules in the .htaccess from roundcube it doesn't
Title: Re: redirection to https
Post by: ipstatic on September 17, 2006, 05:06:29 PM
Do you have these rules as the last set of rules? the letter L in the brackets [R=301,L] means that this rule is the last rule. So make sure these are the last rules.
Title: Re: redirection to https
Post by: tcsoft on November 06, 2006, 03:25:21 PM
and for all those people who are using lighty for example:
add the following lines to index.php

if( !isset( $_SERVER["HTTPS"] ) ){
 header( "Location: [url]https://"[/url] . $_SERVER["HTTP_HOST"] );
 exit();
}
Title: Re: redirection to https
Post by: ipstatic on November 06, 2006, 03:56:23 PM
and for all those people who aren't using lighty for example:

I am using apache, not lightpd. That code will work with apache and mod_rewrite.
Title: Re: redirection to https
Post by: tcsoft on November 06, 2006, 04:24:06 PM
Quote from: ipstatic and for all those people who aren't using lighty for example:

I am using apache, not lightpd. That code will work with apache and mod_rewrite.
sry, corrected my post. wanted to say "people who are using lighty"
Title: Re: redirection to https
Post by: ipstatic on November 06, 2006, 07:35:30 PM
Thats cool, I didn't know if thats what you ment.