我在本地使用Codeigniter WAMP。這裏的代碼工作正常。但我上傳在Cpanel(在example.com中,文件夾名稱調用'mysite
')。還有我改變,CodeIgniter只顯示默認控制器
- DB_NAME(CONFIG/database.php中)
- db_user_name(CONFIG/database.php中)
- DB_PASSWORD(CONFIG/database.php中)
- BASE_URL如http://example.com/mysite(CONFIG /的config.php)
- uri_protocol如REQUEST_URI(CONFIG/config.php中)
也改變.htaccess
(mysite的/ htaccess的)爲,
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the rewritebase to your CI installation folder
RewriteBase /mysite/
# Send everything to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
但不在mysite/application/.htaccess中。它是空的。
問題是,如果我去http://example.com/mysite,它顯示默認頁面正確。但是,如果我點擊任何鏈接(http://example.com/mysite/user/signin),它會顯示相同的默認頁面。但URL已更改。
幫幫我吧,求你了......
的config.php
$config['base_url'] = 'http://example.com/mysite';
$config['index_page'] = '';
$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['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['log_threshold'] = 0;
$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_expire_on_close'] = FALSE;
$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'] = 300;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
define('CSS_FOLDER' , 'application/assets/css');
define('DEFAULT_IMAGE_URL' , 'application/assets/images/default');
routes.php文件
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['user/(:any)'] = 'user/index';
,你能否告訴我們'配置/ config.php'和'配置/ routes.php'? – Boris
@bborisovs現在你可以看到... – KarSho
你的應用程序位於子文件夾中? – bottleboot