仅在Chrome中丢失会话变量/ Cookie [漂亮网址&的.htaccess]

时间:2012-10-03 14:49:44

标签: php codeigniter session google-chrome

这个问题一直存在,并且有一些不同的版本,但我很难过。首先,我会告诉你我的设置是什么......

CodeIgniter安装 适用于所有浏览器,除了chrome ... 我把问题缩小到漂亮的URL和.htaccess 会话存储在DB

基本上如果我使用codeigniter的默认引导程序结构index.php / controller它工作正常但是当我使用mod重写.htaccess时,会话会丢失,仅在chrome中。

我在那里看到的一些事情,我已经尝试过......

favicon.ico in root http://bit.ly/UFsYjjbit.ly/JPUzub

切换到Cookie并设置路径 bit.ly/JPUzub

对我来说,它真的归结为这样一个事实,即index.php的htaccess删除导致了会话问题。我的codeigniter设置如下(注意*如果尝试了这些设置的所有不同配置,如没有域等):

$config['sess_cookie_name']     = 'cisession';
$config['sess_expiration']      = 99999;
$config['sess_expire_on_close'] = TRUE;
$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'] = FALSE;
$config['sess_time_to_update']  = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = ".mydomain.com";
$config['cookie_path']      = "/";
$config['cookie_secure']    = FALSE;

我的htaccess如下(现在它是空白的......):

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php



</IfModule> 

1 个答案:

答案 0 :(得分:0)

尝试将会话过期时间设置为零。

$config['sess_expiration'] = 0;