Welcome Guest, Not a member yet? Register   Sign In
Handing Multiple Sites
#1

[eluser]Insa[/eluser]
I'm trying to run multiple applications with CI, a site and an admin section for said site.

I have 2 application folders: 'application/site' and 'application/admin', and I would like them to be accessed on site.com and site.com/admin.

the article in the user guide about this helped me get the 'site' part working properly, but it wasn't clear on what to do for the 'admin' app.

The problem I'm having is that I'm unsure where to put the index.php file for admin. I can't make a directory 'admin' and place the index file in there, because if I go to site.com/admin, CI will look at 'site/controllers/admin.php' instead of where I want it to look.
I also tried renaming index.php to admin.php and putting it 'site/controller's, but all I got was error messages because it tried to define statics etc etc twice.

How do you guys handle this problem? I've been struggling with it for the past few hours, and as I can't figure it out myself I figured I'd give these forums a try.

Thanks in advance!
#2

[eluser]WanWizard[/eluser]
It's not how I would do it, but you can make this work by modifying your rewrite rules.

Instead of rewriting everything to /index.php, create a condition that matches /admin/..., and rewrite that to /admin/index.php. Then add a condition to the already existing rewrite, excluding /admin (to make sure all links starting with /admin are not rewritten to your site index.php).
#3

[eluser]Insa[/eluser]
I considered that, but surely there's an easier/better way?

How do you guys do this?
#4

[eluser]cahva[/eluser]
Instead of creating two applications mentioned in the userguide, you could use modular separation.

I always use modular separation to create backend(admin) to sites.
#5

[eluser]maltzurra[/eluser]
You can also do the following if you want some webs managed at the same time (in case you share DB):

- Take "application" folder to root, at the same level/folder as system.
- Create "application1" at the same folder
- Inside "index.php" change the following:

$application_folder = "application";

to

switch($_SERVER['HTTP_HOST']) {
case 'www.mysite1.com': $application_folder = "application1"; break;
case 'www.mysite.com':
default: $application_folder = "application"; break;
}


(now you can easily add sites)

- Check both config.cfg files and make sure both base_url are properly set.
- Forward both mysite.com & mysite1.com to your machine.
- Create an admin panel and have fun Smile


That being said, I would actually give a try to what said above.

Cheers to everyone by the way!
#6

[eluser]Insa[/eluser]
Awesome, thanks a lot
#7

[eluser]rawoke083[/eluser]
Hi I have a sort of similar method.
But with this method I share, models,config,web folder

http://ellislab.com/forums/viewthread/181990/
#8

[eluser]cmgmyr[/eluser]
Take a look at Phil's post here - option #3. Instead of Matchbox, use Modular Extensions here

I'm using this setup and it works out really well. If you have any questions, just let me know.

-Chris
#9

[eluser]gowrav vishwakarma[/eluser]
http://codeigniter.com/wiki/Multiple_Sit...CI_system/

Hope this helps




Theme © iAndrew 2016 - Forum software by © MyBB