Reputation: 14448
So here is my situation:
A client of mine has a site based on CodeIgniter hosted at some shared host on domainA.com. They wanted to move the site to a new domain and new host which i have done. I created a new database, and exported the old database and imported it into the new one and i changed the baseurl in the config.php file. The site itself loads up properly.
However, whenever i click on a link that is in the form: 'domainB.com/site/someaction', they all just render or redirect to the homepage. I know PHP, but have no experience with CodeIgniter. I have no idea who created the site initially to reach out to them for assistance, so i am hoping someone on SO can shed some light on what might be happening.
I can provide any other information that might be necessary to try and figure this out. Thanks.
update
.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
config.php:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['base_url'] = "http://www.bidcleangrow.com/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
$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'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
$config['log_threshold'] = 3;
$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'] = 300;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['global_xss_filtering'] = TRUE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./system/application/config/config.php *
Upvotes: 0
Views: 232
Reputation: 20602
Does the new domain have the subdomain "system" setup?
RewriteCond %{REQUEST_URI} ^system.*
UPDATE
After a fair bit of debugging the problem was found to be some odd CGI setup with Apache on the server that was not setting any of the variables that CodeIgniter checks in the way it wished.
Modifying the URI
class method _fetch_uri_string()
(system/libraries/URI.php:92;v1.7.2)
to look at $_SERVER['ORIG_PATH_INFO']
directly when present rather than any other variable solved the issue. $_SERVER['SCRIPT_NAME']
mirrors this variable rather than being a sub-part of it as CodeIgniter expects.
UPDATE 2
There is an easier solution that I just discovered.
Changing $config['uri_protocol']
in system/application/config/config.php
to ORIG_PATH_INFO
has the same effect. Yes, I should have RTFM'd, but I never use CodeIgniter.
Upvotes: 1