【发布时间】:2018-10-30 19:37:47
【问题描述】:
我正在开发 codeigniter 3.1.8。它在我的本地主机上运行良好。但是,当我将它推送到 FTP 服务器时,我只能访问默认的控制器页面。当我尝试访问具有其他控制器的其他视图时,它给了我错误'404 Not Found'
配置:
$config['base_url'] = 'https://*****.net/my_project/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
$config['enable_hooks'] = FALSE;
$config['encryption_key'] = 'xRUqKhsoZ5qV6y3kqARFJFdPqJvp7X2z';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
路线:
$route['default_controller'] = 'main';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
我已经尝试了几个.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /materials-library/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
和
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the rewritebase to your CI installation folder
RewriteBase /sandbox/ci/
# Send everything to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
我可以发送可运行的 ci 结构吗?我认为问题出在你的结构中..
-
我不这么认为。因为我通过创建另一个简单的控制器和视图来尝试使用 CodeIgniter 模板。它仍然存在示例问题。
-
将此 .htaccess 文件放入系统文件夹中,如下所示
要求全部拒绝 全部拒绝
标签: codeigniter