views:

88

answers:

4

I have a main domain name associated with a WordPress site, and then I have a couple other domain names connected to that site as well. I want the other two domains names to point/redirect to specific pages on the site rather than the index page, which is the default. So when domain1.com is typed into the browser, it goes to maindomain.com/domain1page/ (this is how the permalinks are set up). Is this possible?

A: 

Add this to index.php and upload it the root of domain1.com

<?php
    header("location:http://maindomain.com/domain1page/");
?>

OR if you do not have a Hosting package for domain1.com go to the Domain Manager and in Nameservers you can enter a URL to redirect your domain to there.

halocursed
A: 

It's possible, but you must add each domain manually. Just redirect them to your page.

Fu4ny
A: 

Sure - there are lots of different ways to do this. Some registrars let you set up redirects at the domain level. You could also have a website set up for each domain on your server, and then just redirect to the page you'd like from that. You could also use the httpd.ini file to detect the domain and redirect to the appropriate page.

NickAtuShip
A: 

This is a small script that might serve the purpose.

You should place this at the top of header.php in your wordpress theme.

The script will not do anything if a domain is not matched so wordpress will load normal page. Haven't tested, but it should work.

<?php
$host = $_SERVER["HTTP_HOST"];    

//Setup Domains Directory Names Here
$domain1 = 'domainname1.com';
$domain1_dir = 'domain1directoryhere';
$domain2 = 'domainname2.com';
$domain2_dir = 'domain2directoryhere';
$domain3 = 'domainname3.com';
$domain3_dir = 'domain3directoryhere';

//Redirects to directory depending domain.
switch (true){
 case (preg_match("/$domain1/",$host)):
 header("location:/$domain1_dir");
 break;

 case (preg_match("/$domain2/",$host)):
 header("location:/$domain2_dir");
 break;

 case (preg_match("/$domain3/",$host)):
 header("location:/$domain3_dir");
 break; 
}
?>
Codex73