The domains need to go to the main domain's document root.
Are there a few domains? Then you can do this
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^$ /thisPage.php?ID=1234 [QSA,L]
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.com$ [NC]
RewriteRule ^$ /thisPage.php?ID=5678 [QSA,L]
If there are lots of domains you will be better off adding an array to the beginning of the script
- Code: Select all
<?php
$domainToId = array(
'domainA.com' => 1234,
'domainB.com' => 5678,
);
if(getenv('REDIRECT_MRDOM') !== false
&& array_key_exists(getenv('REDIRECT_MRDOM'), $domainToId))
{
$_GET['ID'] = $domainToId[getenv('REDIRECT_MRDOM')];
}
with
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+\.[^\.]+)$ [NC]
RewriteRule ^$ /thisPage.php [E=MRDOM:%2,QSA,L]
Or using a RewriteMap (only if you have access to the httpd.conf file).