CodeIgniter Forums
Addon domain to display class content - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Addon domain to display class content (/showthread.php?tid=38727)



Addon domain to display class content - El Forum - 02-16-2011

[eluser]mthomas9[/eluser]
Hi. Just about to wrap up my first codeigniter project. Just have to get past this last hurdle....

I have an addon domain on top of codeignter. File structure looks like this:

- application
- config
- controllers
- addondomain (class)
- errors
- etc...
- system
- cache
- codeigniter
- etc...
- addondomain
- index.php

Right now.. if if visit addondomain.com I see the content of the index.php file.

What I would like it to do is instead call the class 'addondomain' and display its content.

I have tried the ideas posted to the thread here: http://ellislab.com/forums/viewthread/123442/#653735 with no luck.

What do you think? Is this possible? Thanks in advance...


Addon domain to display class content - El Forum - 02-20-2011

[eluser]mthomas9[/eluser]
I figured it out.. Not sure if its the right way, but it does the trick:

I copied the index.php file from the primary domain to the addondomain subfolder. Changed the $system_path and $application_folder to point back to the primary domains files

$system_path = "../system";
$application_folder = "../application";


Then in the application/config/routes.php file I replaced

$route['default_controller'] = "home";

with

switch($_SERVER['HTTP_HOST'])
{
case 'primary.com':
case 'www.primary.com':
$route['default_controller'] = "home";
break;

case 'addondomain.com':
case 'www.addondomain.com':
$route['default_controller'] = "addondomain";
break;

default:
$route['default_controller'] = "home";
break;
}


And that seemed to do the trick.