Welcome Guest, Not a member yet? Register   Sign In
multiple domains using one codebase ?
#1

[eluser]chrisco23[/eluser]
Hi all,

I'm setting up a new site in code igniter today, and this site needs to have 4 domains that run (point to) the same codebase.

I have another site where multiple sites point into the same codebase, but once you're in the CI world, all subsequent links belong to the same domain (and you only see this domain in the URL once you get there).

In this case, I want to have:

domain1.com/domain1class/domain1method
domain2.com/domain2class/domain2method
domain3.com/domain3class/domain3method

But it all runs from one codebase. The domain names should persist as you traverse the site. Any ideas how to do this? Do I need to dynamically set the base_url somehow?


Thanks,
Chris
#2

[eluser]Avatar[/eluser]
why not use domain forwarding to accomplish this?
#3

[eluser]chrisco23[/eluser]
Guess I've never done that before. When I googled it, I also saw "domain masking", like on this link:

http://www.101domain.com/forwarding.htm

I think domain masking sounds closer to what I need, but it seems to me there are still issues.

From CI's point of view, there is still only one base_url, which I use to generate all kinds of links on all my sites. So if I have domain1.com, ...domain4.com, and I use masking or forwarding to point everything into domain1.com, all subsequent links are still going to say "domain1.com", right? Unless I dynamically change the base_url somehow... Seems like there must be a cleaner solution.

Also this should not have to suffer any performance hit from redirection, nor any SEO hit from same.


Chris
#4

[eluser]Avatar[/eluser]
domain masking is when it will show the daomin name that your on domain4.com (you see domain4.com in browser) for example but actually traffic is coming from domain1.com
#5

[eluser]Avatar[/eluser]
hence it masks the domain name
#6

[eluser]chrisco23[/eluser]
ok, well domain masking might be part of the solution then.

There will only be one real domain / codebase, but to the user, depending on how they arrive, it should appear as one of 4 possible domains. I still think there is going to be some need to dynamically modify the base_url() in config.php also.
#7

[eluser]Avatar[/eluser]
I believe you can see what domain the user is at by just grabbing $_SERVER['HTTP_HOST'] in your app and then do what needs to be done based on that
#8

[eluser]webthink[/eluser]
Why don't you rsync you're single codebase to the multiple domains? I think it's a more scalable solution because if you ever move to multiple servers you'll need to do that anyway.
#9

[eluser]chrisco23[/eluser]
rsync huh, now that's an interesting idea... thinking ahead. I've never used it before but it sounds like a reasonable plan.

It might be a little too complex for this first stage though.

All these sites need to share the same database. The different domains will work as filters for what content each domain shows, but otherwise the domains should appear pretty nearly identical.

The main reason for even having the different domains just has to do with branding, and maybe SEO issues.

I will definitely put some more thought and research into rsync though, thanks.


Chris
#10

[eluser]Sean Murphy[/eluser]
I don't think rsync makes any sense in your case. If all domains should use the same codebase why duplicate it?

Just change your config.php to look like this:
Code:
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'];




Theme © iAndrew 2016 - Forum software by © MyBB