Multi Domains same site differnt landing pages

Permalink
I have 3 domains for one site, I added into the site.php define('REDIRECT_TO_BASE_URL', false);.
All domains go to the home page and work great even keeps the correct domain in the URL. but One the landing pages i added an URL for each page and added the following to my index.php to redirect.
$DomainName = $_SERVER['SERVER_NAME'];
$DomainName = str_replace('www.','', $DomainName );
if (preg_match ("/banana/i", $DomainName)) {
   $_SERVER[PATH_INFO] = '/bananaripeningrooms';
   $DomainName = "BananaRipeningRooms.com" ; }
   elseif (preg_match ("/tomato/i", $DomainName)) {
   $_SERVER[PATH_INFO] = '/tomatoripeningrooms';
   $DomainName = "TomatoRipeningRooms.com" ; }
   elseif ( preg_match ("/avocado/i", $DomainName)) {
   $_SERVER[PATH_INFO] = '/avocado-ripening-rooms';
   $DomainName = "AvocadoRipeningRooms.com" ; }
   else { $DomainName = "dadeservice.com"; }
require('concrete/dispatcher.php');


it works great, but my domains in the URL convert back to the main site domain in the site.php file.

Any Ideas

wizardontherun
 
ryan replied on at Permalink Reply
ryan
mose replied on at Permalink Reply
mose
As ryan said, the Domain Mapper is the best way to do this. Concrete5 converts all URLs to their canonical form. You want that to happen for SEO. The code you posted does not work with this feature. One way it might work is if you make those URLs external links.
mose replied on at Permalink Reply
mose
Ugh, I just read your message, again, and realized that you are modifying index.php. The concept of an external link does not apply there.

It will be difficult to direct the incoming request to a specific page based on the domain name. You might be able to accomplish this with a rewrite rule in the web server. For example, if a request comes in and it doesn't have anything in the path (i.e., the default page for the website), rewrite the request to include the landing page. All other pages should not be rewritten, of course.