子文件夹中的Codeigniter管理应用程序显示404错误页面

i have the following problem..

I've created themain codeigniter website which is located in sub.domain.com and i've also created another codeigniter application (the admin) in sub.domain.com/admin..

*Note that i 'm not using HMVC model, in case someone mentions it...

The thing is that when i'm trying to access the /admin url i get a error 404 redirect problem.

Here are my main files and some extra things i shall mention:

.htaccess file:

Options -Indexes
Options +FollowSymLinks

# Indexes default
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /admin
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php/$1
</IfModule>

My routes.php file:

/**
* Users login - logout
*/
$route['login'] = 'users/users/login';
$route['logout'] = 'users/users/logout'; //Controller located in subfolder

$route['users'] = 'users/users';
$route['users/(:any)'] = 'users/users/$1';
/**
* Redirect any URI after default url
*/
$route['pages/(:any)'] = 'pages/$1';

/**
* Other routes
*/
$route['(:any)'] = 'pages';
$route['default_controller'] = 'pages';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

I also have this in my header.php file in which i redirect the user in login if not logged in etc.. etc..

if (!$this->ion_auth->logged_in() && $this->uri->segment(1) !== 'login') {              
    redirect('login');
} elseif( $this->ion_auth->logged_in() && !$this->ion_auth->is_admin($this->ion_auth->get_user_id()) ){
    redirect('logout');
}

The application/controllers structure is like:

Controllers
-Customers
--Customers.php
-Users
--Users.php
-Pages.php
etc..etc..

I've tried everything (.htaccess, RewriteBase /admin etc..) but still nothing works..

Any ideas? Thanks...

Try this:

.htaccess in main application:

AddDefaultCharset UTF-8
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)admin(.*)$ /admin/index.php$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php/$1
</IfModule>

.htaccess in /admin:

AddDefaultCharset UTF-8
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) /admin/index.php/$1
</IfModule>