Point second domain to main site, serve some different pages

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Point second domain to main site, serve some different pages

Post by jack4ya »

Very cryptic but I'l try to explain: lets say we have a site www.main.com
Now there is a site with www.extra.com

When a users goes to ;http://www.extra.com the content of ;http://www.main.com should be shown.

However a simple redirect or pointer would not suffice because

www.extra.com/contact wil have different content (page?) than
www.main.com/contact
So should the 'home' be different. (and perhaps 2 more pages.)
The other pages (200 some) should be indentical.

Is this even possible?

The main site is multilingual and split like
home
/en
/de
etc..
scooper
Forum Members
Forum Members
Posts: 242
Joined: Fri Dec 09, 2005 12:36 pm
Location: Marlow, UK

Re: Point second domain to main site, serve some different p

Post by scooper »

There's a few ways to do it. An easy would be just to have two content blocks and use Smarty to show the correct one depending on the domain. So in your page template do something like:

Code: Select all


{content label="Content for main.com" assign="main"}
{content block="extra" label="Content for extra.com" assign="extra"}

{if $smarty.server.SERVER_NAME eq 'www.extra.com'}
       {$extra}
{else}
      {$main}
{/if}

You could use the same method to pull in different templates if the pages need to be significantly different.
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Point second domain to main site, serve some different p

Post by jack4ya »

I could make a parent folder (extra) with the different pages in there (for easy editing and comprehension for the users) and in those pages/templates including the check for the server name.

But how would I set up the domains then/server name?
Meaning http://www.extra.com/contact should still say http://www.extra.com/contact (in the addressbar) and not become http://www.main.com/contact

.htaccess? DNS?
Post Reply

Return to “The Lounge”