仅在Chrome中丢失会话变量/ cookie [漂亮的URL和.htaccess]



这个问题一直存在,有几个不同的版本,但我被难住了。首先我会让你知道我的设置是什么…

CodeIgniter安装适用于除chrome之外的所有浏览器。。。我已经将问题缩小到漂亮的URL和.htaccess会话存储在DB 中

基本上,如果我使用codeigniter的默认引导结构index.php/controller,它可以正常工作,但当我使用mod-rewrite.htaccess时,会话会丢失,只在chrome中丢失。

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

根目录中的favicon.icohttp://bit.ly/UFsYjj和bit.ly/JPUzub

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

对我来说,这实际上可以归结为对index.php的htaccess删除导致了会话问题。我的代码点火器设置如下(注意*如果尝试了这些设置的所有不同配置,如无域等):

$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> 

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

$config['sess_expiration'] = 0;

最新更新