0

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

CodeIgniter install 在除 chrome 之外的所有浏览器上都可以正常工作...我已将问题缩小到漂亮的 URL,并且 .htaccess 会话存储在数据库中

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

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

http://bit.ly/UFsYjjbit.ly/JPUzub中的 favicon.ico

切换到 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> 
4

1 回答 1

0

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

$config['sess_expiration'] = 0;
于 2012-10-06T08:03:55.060 回答