CodeIgniter Forums
A domain, a couple sub-domain, & multiplte instances - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: A domain, a couple sub-domain, & multiplte instances (/thread-10210.html)

Pages: 1 2 3


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-22-2008

[eluser]phusiondesign[/eluser]
So, here is my quandary. I have been using CI for awhile now and enjoy it very much. However, I now have a new goal and want to consolidate sites down under one domain.

I have mydomain.com, two.com, and three.com. I want to redirect two.com to two.mydomain.com and three.com to three.mydomain.com. I can accomplish this fine within my registrar.

Each of these sub-domains will have their own respective folder; two.mydomain.com will be located at mydomain.com/two and accordingly.

My problem lies around how I configure CI to operate separate instances of CI on one domain.

I would like to be able to drop a currently working directory tree into a sub-domain's folder and have it work, but it seems I am having issues... not sure what they are coming from either.

It might be my .htaccess, I am currently using...

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|public|robots\.txt)
    RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

I would appreciate any help to get this up and running. Thanks!


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]thinkigniter[/eluser]
&lt;?php
In a single CI installation I would have multiple application folders e.g.

system\application\one
system\application\two
system\application\three


In your folders [ mydomain.com/one, mydomain.com/two ] I would have a Codeigniter index.php file that would have

Code:
$system_folder = "system";
$application_folder = "application/one";

And in the config.php for one/two/three applications I would have

Code:
$config['index_page'] = "/one/index.php";
or
$config['index_page'] = "\one\index.php";

I can NEVER remmeber.

Well I'd give it a go anyway.


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]phusiondesign[/eluser]
Ok, I think I am making progress... but need some further help.

I am starting with a fresh server state and got CI up and running. I got www.mydomain.com working, and it works from system/application/one.

Now I am trying to get one.mydomain.com to work from the same directory. I created a directory at mydomain.com/one and put a CI index.php file at that location but I am getting the below error. Any help?


Code:
Warning: require_once(/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115

Fatal error: require_once() [function.require]: Failed opening required '/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115



A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]Randy Casburn[/eluser]
I don't have a clue what you are 'trying' to do...but this is what I would try to do if 'I were you'...

Code:
[ root ]
  -- [ system ]
     --- [ application ] // this is your ONE appliction //
               |
     [ All the system folders go here... ]
      // your CI CORE is HERE //

  index.php // this is your ONE index.php file //
  .htaccess // this is your ONE .htaccess file //
  license.txt


  -- [ two ]
     index.php// this is your TWO index.php file //
     .htaccess // this is your TWO .htaccess file //
     --- [ application ] // this is you TWO application //
               |



  -- [ three ]
     index.php // this is your THREE index.php file //
     .htaccess // this is your THREE .htaccess file //
     --- [ application ] // this is you THREE application //
               |

The ONE, TWO, and THREE each stand on their own but rely on a single CI core installed in the root of your web server. Each ONE, TWO, and THREE can have individually controlled .htaccess files. And each application has it's own set of configuration files that are separate.

Does this help?

Randy


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]phusiondesign[/eluser]
Randy- I appreciate your help.

I am trying to do pretty much exactly what you just described, and I will use your setup. I reconfigured it that way now, but am having the same issue with the application not in the root directory (two/application). The index.php file at domain.com/two/ gives me the same error I posted above.

How do I reconfigure the index.php & config.php file to see the system folder?


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]Randy Casburn[/eluser]
First, you'll want to get into [root][two]index.php and set $system_folder to

$system_folder = "/system"; Note the leading slash. This will set the root/system folder as your CI base.

---
Ok...so go into [root][two][application][config]

and you'll want to change the settings there according the documentation.

Do that for THREE too. And that should be it.

Let me know.

Randy


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]phusiondesign[/eluser]
Ok, so I found this http://ellislab.com/codeigniter/user-guide/general/managing_apps.html, and am trying to follow it. It is very similar to what you suggested.

Everything works except the sub-domain functionality, where I want two.domain.com to load /system/application/two

I have set two/index.php

Code:
$system_folder = "/system";
$application_folder = "/system/application/two";

I continue to get an error:
Code:
Warning: require_once(/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php)
[function.require-once]: failed to open stream: No such file or directory in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115

Fatal error: require_once()
[function.require]: Failed opening required '/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115

If I put the two/index.php file at root, it works fine. I guess for some reason it does not like the base functionality. Any more thoughts?


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-23-2008

[eluser]Randy Casburn[/eluser]
If you are following the file structure I suggested, then you should not have changed the application folder setting at all. That was not in my instructions to you. $application_folder should be:

$appliction_folder = 'application';

===

Try that and tell me what happens.

===

If you've changed the folder structure from what I told you above then this may or may not work.

Randy


A domain, a couple sub-domain, & multiplte instances - El Forum - 07-24-2008

[eluser]phusiondesign[/eluser]
Randy - I followed your instructions again and adjusted the application call to $appliction_folder = ‘application’;

I still get the same error... perhaps it does not like the leading slash on the system part.

The error:
Code:
Warning: require_once(/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php)
[function.require-once]: failed to open stream: No such file or directory in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115

Fatal error: require_once()
[function.require]: Failed opening required '/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/h/u/phusiondesign/html/domain/index.php on line 115



A domain, a couple sub-domain, & multiplte instances - El Forum - 07-24-2008

[eluser]Randy Casburn[/eluser]
/home/content/p/h/u/phusiondesign/html/domain/system/codeigniter/CodeIgniter.php

You'll need to translate this path for me. Given the template that I provided above it appears that

domain = [ root ]

is this correct?

Randy