只有默认控制器在CodeIgniter 3中工作



在服务器上,我创建了一个子域,放置CodeIgniter 3代码。它的默认控制器在我的控制器路径所在的位置工作,但有很多帖子。错误显示找不到404页。我尝试过多种解决方案,但对我不起作用。我的.htaccess文件是

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#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

Bas url是

defined('BASE_URL') OR define('BASE_URL', (is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/');
$config['base_url'] = BASE_URL;
$config['index_page'] = '';

我的路线是:

$route['default_controller'] = "our_menu";
$route['our_menu/menu'] = "our_menu/menu";
$route['product/:num'] = 'catalog/product_lookup';
$route['admin'] = 'admin/login';
$route['404_override'] = '';

我还通过删除default_controller之外的其他路由来测试这一点。我的php版本是5.6

有人知道我们如何处理其他路线吗。感谢

My查询字符串已启用,对于此重定向,如

redirect('c=welcome &m=index', 'refresh');

和URLindex.php?c=our_menu&m=menu

或者,如果在config.php中更改配置,则需要更改c and m

$config['enable_query_string']=FALSE
$config['controller_trigger']='c'
$config['function_trigger']='m';

如果我将$config['enable_query_strings']=TRUE更改为$config['enable_6query_strings']=FALSE,则URL的工作方式与index.php/our_menu/menu类似

相关内容

  • 没有找到相关文章

最新更新