Hi, I’ve been trying to figure this out for a while without much luck and hope someone out there can help me out...
My MODx (0.9.6.3) site gives details of a number of holiday rental properties (in French and English) and I want each individual property to be accessed by their own unique domain eg. www.property1.com directly maps on to property1.html (friendly urls are on) page in my modx installation.
The method that I thought would work was to point the www.property1.com domain to the top-level of my modx installation and then place a snippet on the landing page that detected the HTTP_HOST system variable and then route to the property1.html document by changing the header location:
$propdomain = $_SERVER['HTTP_HOST'];
switch($propdomain) {
case "www.property1.com" :
$whereto = 32;
break;
default:
$whereto = 31;
}
header ("location: ".$modx->makeUrl($whereto, '', '', 'full'));
The problem with this was that url masking is not present so the host domain had already changed to the default domain before the snippet was executed so it always came through to the default setting. I also tried to use HTTP_REFERER without any luck either.
Would using the rewriteRule in .htaccess provide a better solution? I don’t have much experience in using this so any advice much appreciated.