Roundcube Community Forum

 

redirection to https

Started by renevdb, September 16, 2006, 02:31:09 AM

Previous topic - Next topic

renevdb

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!!
Eddie would go !

ipstatic

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!

renevdb

The rules work, but when used with the other rules in the .htaccess from roundcube it doesn't
Eddie would go !

ipstatic

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.

tcsoft

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();
}

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.

tcsoft

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"

ipstatic

Thats cool, I didn't know if thats what you ment.