More than one site with CodeIgniter |
[eluser]Marc Cools[/eluser]
Hi, I 'm new to Codeigniter. When you have a site running with Codeigniter your structure is like this: /path/to/myspace/{CodeIgniter core} /path/to/myspace/application /path/to/myspace/index.php When I want more than one site but using the same framework (so avoiding more than one Codeingniterinstallation) what do I have to do? So I want somthing like this: @www.secondsite.com path/to/my/secondsite/index.php <-- What code do I need here? @www.firstsite.com path/to/my/firstsite/{Codeigniter core} <-- common library, frontcontroller and so on. path/to/my/firstsite/application_firstsite path/to/my/firstsite/application_second_site path/to/my/firstsite/index.php <-- kickstart for www.firstsite.com What about the URI? How can I transfer it to the Codeigniter framework on the other site without showing up the other sites' name in the URI? How do i set the right basepath in secondsite/index.php refering to .../firstsite/... Yeah, I know. Lot's to learn. But I 'm a fast learner! Thanks, Marc
[eluser]pistolPete[/eluser]
Running Multiple Applications with one CodeIgniter Installation
[eluser]Marc Cools[/eluser]
The problem is sites on other locations. When someone sends 'www.firstsite.com' the file path/to/firstsite/I/got/from/my/provider/index.php is called. When someone sends 'www.secondsite.com' the file path/to/secondsite/I/got/from/my/other/provider/index.php is called. How do i even get to the firstsite from the secondsite?
[eluser]jdfwarrior[/eluser]
If I'm understanding correctly, sounds more like your trying to run two sites in two different locations from the same CI installtation? pistolPete is talking about running two actual applications from within the same area. Which are you doing?
[eluser]jedd[/eluser]
Hi Marc and welcome to CI. Because CI is inexpensive (in every sense of the word) to run, it might be easier to run them as two entirely separate codebases - unless(!) you're intending to share a lot of code between the two sites .. ? There are advantages to sharing a single CI instance, but OTOH there are some compelling reasons to keep them separate. You may (though it's not clear from your question) be looking for something like mod_proxy for the apache web server, but I'll wait until you answer jdfwarrior's question.
[eluser]Marc Cools[/eluser]
I prefere one installation. I just like it. All together. My problem is that I don't understand how I can 'redirect' a second site. The first site has an index.php file. In that file is the next code: Code: error_reporting(E_ALL); I know the the second site has to set Code: $application_folder = "application_other_site"; Code: $application_folder = "application/second"; That is not the problem. When there is just one workspace where there is no security problem with accessing other files, I still don't get it. When I send 'http://www.firstsite.com', I will be redirected to 'path/to/workspace/index.php'. Where will I be when I send 'http://www.secondsite.com'. It can't be 'path/to/workspace/index.php'? How will I know who's calling mij index.php? So, onces I can redirect correctly (setting $application_folder and BASEPATH) my problem is solved. Maybe now you understand what my problem is? My question is a foolisch one. Sorry that I realy don't get it. Thanks. Marc
[eluser]jedd[/eluser]
Hi Marc, Don't worry - the question isn't foolish, I am just not sure I understand what you're trying to gain here, and so I'm hoping I can talk you out of trying to do it! Quote:I prefer one installation. I just like it. All together. Okay, but keep in mind ... Doing this only makes sense if the two systems are going to share a lot of code, and even then it's better practice (IMO) to put the shared code into libraries, and you can then easily sync those out to multiple CI instances. CI is 2MB. So - you're saving 2MB of disk space (value : $0.00004 approximately) by doing this. You're also going to hit problems if you ever want to upgrade a CI version for one of your sites, but not necessarily for the other (you haven't tested it on that one app yet, a known bug or 'feature change' will bite you, etc). Most importantly ... the current problem. Now, if you're not convinced, back to the actual problem. It doesn't sound like you've read this page (but perhaps you have?) : [url="http://ellislab.com/codeigniter/user-guide/general/managing_apps.html"]http://ellislab.com/codeigniter/user-guide/general/managing_apps.html[/url] Particularly the bit down the bottom, about having multiple index.php files, but of course they can/will be named something else. EDIT Hang on .. I just re-read the entire thread .. so your big problem is how you get from one different *physical* site, not just 'site' in the sense of sub-directory under CI .. is that it? You want to be able to do a link between two different web server instances .. ?
[eluser]tomcode[/eluser]
You can share one system installation with several applications. 1. have serveral of CI's index.php files in one folder by calling them differently, application1.php, application2.php, a.s.o. 2. have several folders each with it's own index.php in both cases You have to set the paths accordingly : for 1. You just need to changethe application path for 2. You'll have Your system probably somewhere else, so You need to set the system path, too then You bind the applications via DNS entries.
[eluser]tomcode[/eluser]
DNS = Domain Name Service In the admin area of Your Web space account you should be able to configure the DNS Zones, that's also where You create Your subdomaines. Though not all hoster offer these kind of services. |
Welcome Guest, Not a member yet? Register Sign In |