[英]CodeIgniter 3 on remote server issues
I am trying to setup a production server with a codeIgniter project. 我正在尝试使用codeIgniter项目设置生产服务器。 All my
http
request redirects to homepage that login
page. 我所有的
http
请求都重定向到该login
页面的首页。 I have followed a few instructions from StackOverflow but in vain Following is my config.php
settings 我已经遵循了StackOverflow的一些指示,但徒劳无功以下是我的
config.php
设置
$config['base_url'] = 'http://XXXXX.local/';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';
The .htaccess
settings .htaccess
设置
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
And my sites-enabled
config in apache2 sites-enabled settings 和我的
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>
For eg if I open on browser http://XXXXX.local/assets/js/jquery.validate.min.js
, it opens homepage 例如,如果我在浏览器上打开
http://XXXXX.local/assets/js/jquery.validate.min.js
,它将打开主页
Also my session does not work, it prints empty..I'm setting like $this->session->set_userdata('test','hellow world');
我的会话也无法正常工作,它打印为空。.我的设置像
$this->session->set_userdata('test','hellow world');
Here's my configuration 这是我的配置
$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;
Please help! 请帮忙!
The document root in your Apache config needs to be a folder, not a file. Apache配置中的文档根目录必须是文件夹,而不是文件。
Change 更改
DocumentRoot "/var/www/html/xxx/index.php"
<directory "/var/www/html/xxx/index.php">
to 至
DocumentRoot "/var/www/html/xxx"
<directory "/var/www/html/xxx">
Don't forget to restart Apache after you've updated the config. 更新配置后,别忘了重新启动Apache。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.