这是我面临的一个奇怪的问题。当我从任何浏览器访问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]
非常感谢您解决此问题的任何帮助。
答案 0 :(得分:1)
我假设dev文件夹是abc.com的开发区域,或者只是一个静态站点?但无论如何。
在您的abc.com/.htacces文件中,从重写中排除dev文件夹,以便abc.com中的codeigniter不会处理对该文件夹的请求。
RewriteCond $1 !^(index\.php|assets|fckeditor|dev|robots\.txt)