|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| 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. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
|
||||
|
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
}
__________________
Jerry Russell Cooking by the Seat of my Pants | Please don't feed the writer | The Spun Puppy |
|
|||
|
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 |
|
||||
|
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");
}
__________________
Jerry Russell Cooking by the Seat of my Pants | Please don't feed the writer | The Spun Puppy |
|
|||
|
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]
Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies |
|
|||
|
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 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |