在根显示www.example.com,但www.example.com/dev/admin给出错误


www.example.com at the root shows up but www.example.com/dev/admin gives error

我正面临一个奇怪的问题。当我从任何浏览器访问www.example.com时,它显示正常。当我访问位于根下的开发文件夹中的站点,如www.example.com/dev或www.example.com/dev/admin,它显示一个空白页面和一个错误页面,说遇到错误无法加载默认控制器。请确保在你的Routes.php文件中指定的控制器是有效的。

我正在使用CodeIgniter框架和PHP v 5.0

在进一步的调试中,我发现在Router.php文件中出现了一些异常。

当我从_set_request中注释了对方法_validate_request的调用时,它开始工作。但有些页面仍然无法工作。这些页面的控制器在www.example.com/dev/system/application/controllers/admin

config.php

$config['base_url']     = "http://example.com/dev/";
#$config['index_page'] = "index.php";
$config['index_page'] = "";
#$config['uri_protocol']        = "AUTO";
$config['uri_protocol'] = "REQUEST_URI";
$config['url_suffix'] = "";
$config['language']     = "english";
$config['charset'] = "UTF-8";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_=?&'-';
$config['enable_query_strings'] = TRUE;
$config['controller_trigger']   = 'c';
$config['function_trigger']     = 'm';
$config['directory_trigger']    = 'd'; // experimental not currently in use
$config['log_threshold'] = 4;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '';
$config['encryption_key'] = "";
$config['sess_cookie_name']             = 'ci_session';
$config['sess_expiration']              = 7200;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']              = 'ci_sessions';
$config['sess_match_ip']                = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 7200;
$config['cookie_prefix']        = "";
$config['cookie_domain']        = "";
$config['cookie_path']          = "/";
$config['global_xss_filtering'] = FALSE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
/*
|--------------------------------------------------------------------------
| CUSTOM CONFIGURATION SETTINGS
|--------------------------------------------------------------------------
|
|
*/
// Table Prefix
$config['tableprefix'] = '';
// CSS Path
$config['css_path'] = 'assets/css/';
// JS Path
$config['js_path'] = 'assets/js/';
// Image Path
$config['images_path'] = 'assets/images/';
// Upload Path
$config['upload_path'] = 'assets/upload/';
// Email Template Path
$config['email_template_path'] = 'assets/email/';
// Allowed Upload Image Extensions
$config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
// Allowed Upload File Max Size
$config['max_size']  = '10240';
// Email Settings
//$config['admin_to_email'] = 'info@xxx.com';
$config['admin_to_email'] = 'yyyy@gmail.com';
$config['noreply_email'] = 'no-reply@xxxx.com';
$config['noreply_name'] = 'yyyyy';
// Page Settings
$config['page_title'] = 'yyyy';
$config['meta_description'] = '';
$config['meta_keywords'] = '';
$config['meta_author'] = '';
## Uploaded Image Size Setting
// Image Sizes
$config['ad_100X100'] = '100X100_';
The following is in routes.php
$route['default_controller'] = "home";
$route['scaffolding_trigger'] = "";
The value in .htaccess
RewriteEngine on
RewriteCond $1 !^(index'.php|assets|fckeditor|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?$1 [L,QSA]

我假设开发文件夹是abc.com的开发区域,还是只是一个静态站点?但不管。

在abc.com/.htacces文件中,将dev文件夹从重写中排除,这样abc.com的codeigniter就不会处理对该文件夹的请求。

RewriteCond $1 !^(index'.php|assets|fckeditor|dev|robots'.txt)