WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2007, 02:46 AM
ackerley1 ackerley1 is offline
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 247
ackerley1 RepRank 0
Default Parked Domains and Landing Pages

How do I get different pages to initially display when people arrive and my site from parked domain?

In PHP preferable.

I have:
domain1.com > Corporate Area
domain2.com > Product Area

When someone enters or is directed to domain2 I want the product page to display, not the corporate page.

How can this be done?
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
  #2 (permalink)  
Old 05-09-2007, 12:14 PM
Jerry's Avatar
Jerry Jerry is offline
WebProWorld Pro
 

Join Date: Nov 2003
Location: Northern Texas
Posts: 259
Jerry RepRank 0
Default

use php's $_SERVER['HTTP_REFERER'] to figure out which page refered to the current, like so...

Code:
<?php
$referring_page = $_SERVER['HTTP_REFERER'];
if( $referring_page == 'domain1.com'){
     //Do Something
}elseif ($referring_page == 'domain2.com'){
     //Do Something Else
}
Reply With Quote
  #3 (permalink)  
Old 05-09-2007, 02:18 PM
ackerley1 ackerley1 is offline
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 247
ackerley1 RepRank 0
Default

Thanks, now how would I designate which page to display?

Would I use a refresh/redirect to the proper URL, or is there another way to display the right page?

You can see what I mean here:
www.bcowwoutfitters.com and www.texaswaffles.com
if bcowwoutfiters is the URL used, then I want index.php to display. If texaswaffles is the URL I want index2.php to display.

Now they both use similar headers and footers with different style sheets, so I am wonding if I should set the page content as an include/require and then declare that in the statement you provide.

Any suggestions on how this can be easily achieved?

Thanks
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
  #4 (permalink)  
Old 05-09-2007, 02:45 PM
Jerry's Avatar
Jerry Jerry is offline
WebProWorld Pro
 

Join Date: Nov 2003
Location: Northern Texas
Posts: 259
Jerry RepRank 0
Default

I would think what you're looking for would be as easy as using redirects.

Code:
<?php
$referring_page = $_SERVER['HTTP_REFERER'];
if( $referring_page == 'www.bcowwoutfitters.com'){
     header("Location: http://www.bcowwoutfitters/index1.php");
}elseif ($referring_page == 'www.texaswaffles.com'){
     header("Location: http://www.texaswaffles.com/index2.php");
}
Or use the simplest method, which would be to put each domin in it's own virtual domain on the server and save yourself the headaches of possible code breaks. (btw, my code has absolutely no error checking!)
Reply With Quote
  #5 (permalink)  
Old 05-09-2007, 03:21 PM
brian.mark's Avatar
brian.mark brian.mark is offline
Administrator
 

Join Date: Jul 2004
Location: Omaha
Posts: 2,717
brian.mark RepRank 2brian.mark RepRank 2
Default

Referrer would be for someone clicking from elsewhere and not the current page, so I don't think the above code would work as expected.

I would personally use .htaccess to accomplish this.

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} .*domain1.com
RewriteRule ^$ http://www.domain1.com/page1.html [L]

RewriteCond %{HTTP_HOST} .*domain2.com
RewriteRule ^$ http://www.domain2.com/page2.html [L]
That would allow you to make it work without redirects. The ^$ in the rule means root of the domain only. I put the .* on the conditions to match domain1.com or www.domain1.com. If it's domain1.com without the www, this would redirect. You could create 4 sets of conditions and rules if you wanted to keep that straight, too.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
  #6 (permalink)  
Old 05-09-2007, 03:54 PM
ackerley1 ackerley1 is offline
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 247
ackerley1 RepRank 0
Default

I definitely want to avoid the redirect. The .htaccess seems simple and viable.

One concern I have is making sure that it only applies to the index page(s) Once landed on the site and displaying what they want to see the rest of the navigation and pages will be the same, regardless of domian.
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: domains, landing, pages, parked



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0