Codeigniter只能显示默认控制器

Codeigniter只能显示默认控制器,codeigniter,Codeigniter,我正在研究codeigniter 3.1.8。它在我的本地主机上运行良好。但是,当我将其推送到FTP服务器时,我只能访问默认控制器页面。当我试图访问具有其他控制器的其他视图时,它给出错误“404未找到” 配置: $config['base_url'] = 'https://*****.net/my_project/'; $config['index_page'] = ''; $config['uri_protocol'] = 'REQUEST_URI'; $config['enable_hook

我正在研究codeigniter 3.1.8。它在我的本地主机上运行良好。但是,当我将其推送到FTP服务器时,我只能访问默认控制器页面。当我试图访问具有其他控制器的其他视图时,它给出错误“404未找到”

配置:

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

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/materials library/index.php/$1[L]
ErrorDocument 404/index.php


重新启动发动机
#将rewritebase设置为CI安装文件夹
重写基本/沙盒/ci/
#将所有内容发送到index.php
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]

任何帮助都将不胜感激。谢谢

试试这个,它对我有用。确保文件名必须为“Yourcontroller.php”,大写字母为“Y”

.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
确保已加载uri库(application/config/autoload.php)

在此处签出控制器命名约定:。希望这对你有帮助

问候

这是一个正常的问题,要解决它,您必须在文件夹中定义.htaccess文件。如下文所述 这两个文件都在您的文件夹中。 将此文件放入主文件夹并指定.htaccess的名称

将此文件放入应用程序文件夹并指定.htaccess的名称


要求全部拒绝
全盘否定
1)第一个控制器名称和类名第一个字符大写字母
示例::CapturistaCtrl
2) 转到配置更改::
->$config['index_page']='index.php';删除index.php
->$config['uri_protocol']='REQUEST_uri';删除(请求URI)
3) .htaccess
重新启动发动机
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
set.htaccess文件
列表项

我已经试过了,但仍然不起作用。谢谢你的建议。$config['encryption_key']='';删除encpt密钥值请立即重试是否正常??不,仍不正常。仍然出现相同错误404未找到检查主文件夹、系统文件夹和控制器。htaccess文件是否存在???我是否可以发送可运行ci结构???我认为问题出在你们的结构上,我不这么认为。因为我尝试使用CodeIgniter模板,通过创建另一个简单的控制器和视图。它仍然存在sampe问题。请将此.htaccess文件放入您的系统文件夹,如下所示:要求全部拒绝拒绝我所做的一切,但仍不工作。它只能显示默认控制器页面
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
$autoload['helper'] = array('url', 'file');
RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
<IfModule authz_core_module>
  Require all denied
</IfModule>
<IfModule !authz_core_module>
  Deny from all
</IfModule>
1) first controller name and class name first character capital letter
   example :: CapturistaCtrl
2) go to config changes ::
   -> $config['index_page'] = 'index.php'; remove index.php
   -> $config['uri_protocol']   = 'REQUEST_URI'; remove (REQUEST_URI)
3) .htaccess
   <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond $1 !^(index\.php|resources|robots\.txt)
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
   </IfModule>

set .htaccess file 

List item