Welcome Guest, Not a member yet? Register   Sign In
1and1 hosting .htaccess with SSL mod_rewrite and all browser working sessions.
#1

[eluser]Ty Bex[/eluser]
I am having a bit of an issue with mod_rewrite using SSL and the sessions at 1and1.com.
I want to fix and shar all the 1and1.com config setting here in one place.

Mod Rewrite with out SSL works great.
Sessions not working in IE. If I add a domain name to the cookie settings IE will hold sessions bit Chrome and Safari stop working.

Code:
AddType x-mapp-php5 .php  # This turns on PHP 5 at 1and1

Proper and working .htaccess mod_rewrite at 1and1
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|public|images|tmp|robots\.txt|css)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

config.php
Code:
## URL/URI CONFIG
$config['base_url']    = "http://www.yourserver.com";
$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";

## SESSIONS  <NOT WORKING WITH Internet Explorer>
$config['sess_cookie_name']    = 'cisession';
$config['sess_expiration']    = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']    = 'ci_sessions';
$config['sess_match_ip']    = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";


---------------------------------------------------------------


SSL Mod Rewrite not working with 1and1.com
It does not rewrite the url to https. I am not sure if I need a ? in the rule or not.
Although it does rewrite SSL on a linked image that was
http://www.yoursite.com/images/template/member-gallery.jpg
to
https://www.yoursite.com/images/template/member-gallery.jpg

So it just a config issue some where in the rule
Code:
AddType x-mapp-php5 .php


<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} (ecart|backend|members|member|login)
    RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
    
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(ecart|backend|members|member|login)
    RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>



Code:
## URL/URI CONFIG
$config['base_url'] = "http".((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "")."://www.yourserver.com".str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";




Theme © iAndrew 2016 - Forum software by © MyBB