Welcome Guest, Not a member yet? Register   Sign In
URL shows error 404 instead of default controller
#1

Hi,

I'm looking for a bit of guidance with this one, as it's proving to be a bit tricky!

My set up is as follows:
  • I have /application and /system in a non-public folder
  • I have two URLs (at the moment): example.com and another.example.com
  • In my public_html folder, I have index.php and /another/index.php (for the subdomain) - both pointing to the same application and system folder (essentially, two sites running same config etc.). I'm not sure if this is the best approach, but having tried a few, this is the only one that works (except the issue below)
  • Both config and routes are set up to check $_SERVER['HTTP_HOST'] and set the values based on this
  • All controller files for 'another.example.com' are stored in /controllers/another/
So, in my routes.php file, I have the following:
PHP Code:
$route['404_override'] = '';
$route['translate_uri_dashes']             = TRUE;

if (
strstr($_SERVER['HTTP_HOST'], 'another.example.com')) {
    
$route['default_controller']     = "another/login/index";
    
$route['(.+)']             = 'another/$1';
}
else
{
    
$route['default_controller'] = "welcome";


However, visiting just 'another.example.com' shows a 404 rather than /another/login

Hopefully I've given more than enough info, but knowing me I've missed something simple!

Any help appreciated!
Reply


Messages In This Thread
URL shows error 404 instead of default controller - by Parker1090 - 04-10-2016, 06:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB