php – CodeIgniter仅显示默认控制器

前端之家收集整理的这篇文章主要介绍了php – CodeIgniter仅显示默认控制器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Local WAMP中使用Codeigniter.代码工作正常.但我上传到Cpanel(在example.com内部,文件名称调用’mysite’).我改变了,

> db_name(config / database.PHP)
> db_user_name(config / database.PHP)
> db_password(config / database.PHP)
> base_url as http://example.com/mysite(config / config.PHP)
> uri_protocol as 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['base_url'] = 'http://example.com/mysite/';

比以下更好:

$config['base_url'] = 'http://example.com/mysite';

试试这个 :

RewriteBase /

RewriteEngine on
RewriteCond $1 !^(index\.PHP|images|robots\.txt)
RewriteRule ^(.*)$/mysite/index.PHP/$1 [L]
原文链接:https://www.f2er.com/php/135358.html

猜你在找的PHP相关文章