CodeIgniter 3 关于远程服务器的问题

CodeIgniter 3 on remote server issues

我正在尝试使用 codeIgniter 项目设置生产服务器。 我的所有 http 请求都重定向到 login 页面的主页。 我遵循了 Whosebug 的一些说明,但没有成功 以下是我的 config.php 设置

$config['base_url'] = 'http://XXXXX.local/';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';

.htaccess设置

RewriteEngine on
RewriteCond  !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L,QSA]

还有我的 sites-enabled 在 apache2 站点启用设置中的配置

<VirtualHost *:80>
    ServerName    XXXXX.local
    DocumentRoot "/var/www/html/xxx/index.php"
    <directory "/var/www/html/xxx/index.php">
        DirectoryIndex index.php
        AllowOverride all
        Order Allow,Deny
        Allow from all
    </directory>
</VirtualHost>

例如如果我在浏览器 http://XXXXX.local/assets/js/jquery.validate.min.js 上打开,它会打开主页

我的会话也不起作用,它打印为空..我正在设置 $this->session->set_userdata('test','hellow world'); 这是我的配置

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_cookie_name'] = '';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

请帮忙!

A​​pache 配置中的文档根目录必须是文件夹,而不是文件。

改变

DocumentRoot "/var/www/html/xxx/index.php"
<directory "/var/www/html/xxx/index.php">

DocumentRoot "/var/www/html/xxx"
<directory "/var/www/html/xxx">

更新配置后不要忘记重启 Apache。