I have a CodeIgniter installation on my local machine. I used hosts file in Windows and Apache config to make it work under my real domain name (eg. site.com). It worked great, so today I uploaded everything to my host. I changed hosts and Apache config, flushed DNS via ipconfig /flushdns and now entering certain URLs (games) gives me 404.
My controller name starts with uppercase but I have routes set like this:
$route['Games/(:num)/(:any)'] = 'Games/Game/$1';
$route['games/(:num)/(:any)'] = 'Games/Game/$1';
Either entering this by games/14/game or Games/14/game doesn’t work.
Searching for images (using solution given by merahulpk) doesn’t work also.
What can it be?
Unfortunately, it’s still under development, so I can’t give you the aaddess just yet.
— edit —
Image inclusion script:
views/game.php
<?php
$image_path = $this->config->item('base_path').'images/games/'.$info['id'].'-s.jpg';
if(file_exists($image_path)) {
$small = $this->config->item('base_url').'images/games/'.$info['id'].'-s.jpg';
$big = $this->config->item('base_url').'images/games/'.$info['id'].'-b.jpg';
} else {
$small = $this->config->item('base_url').'images/games/none-m.png';
$big = $this->config->item('base_url').'images/games/none-m.png';
}
?>
config/sit-config.php
<?php
$config['base_url'] = "http://".$_SERVER['SERVER_NAME'] . str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
if(!defined('DOCUMENT_ROOT')) define('DOCUMENT_ROOT',str_replace('system/application/config','',substr(__FILE__, 0, strrpos(__FILE__, '/'))));
$config['base_path'] = constant("DOCUMENT_ROOT");
?>
Don’t use uppercase letters in your routes. Use all lowercase like this:
Routes won’t work if you use uppercase controller name. As for method names, they can be either lowercase of uppercase, both will work… no need for duplicate routes!