开发者

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

Here is a wierd problem I am facing. When I access www.example.com from any browser it shows up alright. When I access the site which resides in the dev folder under the root like www.example.com/dev or www.example.com/dev/admin it shows a blank page and an error page saying An Error Was Encountered Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.

I am using CodeIgniter framework and PHP v 5.0

On further debugging I found that it is getting some exception was in Router.php file.

When I have commented the call to the method _validate_request from _set_request, it started working. But some of the pages are still not working. The controller of these pages are inside www.example.com/dev/system/application/controllers/admin

Here is 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'开发者_JAVA百科] = "";

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

Any help to resolve this will be much appreciated.


I am assuming that dev folder is development area for abc.com, or just a static site? But regardless.

In your abc.com/.htacces file, exclude dev folder from rewriting, so that codeigniter from abc.com dosen't handle requests to that folder, as such.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜