Multiple domains, same codebase

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ajtacka
Forum Newbie
Posts: 3
Joined: Thu Jan 22, 2009 10:22 am

Multiple domains, same codebase

Post by ajtacka »

I've been asked to add a couple of 'local' domains to the site I'm working on now. This means that along with site.com, we now have (eg) site.es, site.cz and site.de.

All these domains will be sharing the same codebase, just displaying a different language. Ideally, if someone logs on to site.com, they will be logged on when they later go to site.de, or vice versa. Obviously I've run into problems with cross-domain cookies not being allowed (and rightly so). I've already found one solution which uses redirecting magic to basically set the cookie on both the local and .com domains. This will do the job, and I have started implementing it, but I have a nagging feeling it's not the 'right' solution.

So my question is, is there a completely different way to get around this problem? If there is a way to show the local domain to the user but internally (including for setting cookies) use the .com domain, that would be perfect. I have to admit that server admin definitely isn't my strong point, so I have no idea what's possible, easy, hard or just plain impossible.

Thanks for your help.
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

Re: Multiple domains, same codebase

Post by Da_Elf »

id do it where each was on the same server but stored in a different folder. all the code will be in a code folder and inside each language folder is just an index file that sets a cookie for that language or a session for that language

in other words id set them up as sub-domains rather than parked domains
ajtacka
Forum Newbie
Posts: 3
Joined: Thu Jan 22, 2009 10:22 am

Re: Multiple domains, same codebase

Post by ajtacka »

Da_Elf wrote:in other words id set them up as sub-domains rather than parked domains
I personally wouldn't do it domains either, but in this case I don't have any choice - the orders are from on high.
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Re: Multiple domains, same codebase

Post by Stryks »

I'd take a look at your host's control panel and look for a Domain Alias section. Either that or contact them about it.

Multiple domains, same codebase.

Cheers
ajtacka
Forum Newbie
Posts: 3
Joined: Thu Jan 22, 2009 10:22 am

Re: Multiple domains, same codebase

Post by ajtacka »

Stryks wrote:I'd take a look at your host's control panel and look for a Domain Alias section. Either that or contact them about it.

Multiple domains, same codebase.

Cheers
Thanks Stryks, I think that's about what I was looking for. We have our own servers and admin - could you give me a few more specific details so I know what to ask for? Is it something in httpd.conf?

This is the area where I get a bit murky, but I need to have some idea of exactly what needs to be done. A (very) quick google search only seems to turn up answers for specific hosts using control panels.
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Re: Multiple domains, same codebase

Post by Stryks »

The following link might help you out.

Link
Post Reply