RewriteCond %{HTTP_HOST} ^seconddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.seconddomain.com$ RewriteRule ^(.*)$ index.php?page_id=78 [NC,QSA]
The “problem” with this is that it rewrites seconddomain.com/<everything>
to /index.php?page_id=78
. If you only want the second domain’s home page to be served with page_id=78
then you should change the RewriteRule
pattern to match just the home page (ie. an empty URL-path). For example:
RewriteCond %{HTTP_HOST} ^(www\.)?seconddomain\.com
RewriteRule ^$ index.php?page_id=78 [QSA,L]
(I’ve also combined the two RewriteCond
directives, escaped the dots and removed the trailing $
to catch a FQDN. The NC
flag is also redundant here and the L
flag is probably preferable to prevent further directives being processed unnecessarily.)
Then, for specific pages you would need to duplicate the above directives. For example:
RewriteCond %{HTTP_HOST} ^(www\.)?seconddomain\.com
RewriteRule ^specific-page$ index.php?page_id=NN [QSA,L]
Where NN
is the appropriate page_id
for /specific-page
.
If you have many URLs then the directives can be altered to avoid having to include the RewriteCond
directive every time.