redirect domain2.com to domain1.com/domain2/

nopf

New member
Joined
Apr 26, 2004
Messages
3
How do I do this

I have a two domain names, one hosting account. I want to redirect www.domain2.com to www.domain1.com/domain2/

I have tried a bunch of .htaccess scripts in my public_html folder, but nothing seems to work and my hosts will provide no support in this matter.

help?
 
talking about that,

it would be really really good if DA allowed you to create Domain Redirections without the user having web hostings. Also email forwarding without the user having hosting... any ideas?
 
Maybe you could use php?

PHP:
<?php
header("Location: url");
?>
 
php? that would require the users actually going to a file.

I need something at the server admin level that lets one domain go through to the public_html, and the other domain route to a subfolder.
 
What is a virtual host? Is this something I can do through the DA control panel (I don't see anything like it.) Is this something my hosting company would have to set up? Would this be something that would piss them off if I asked them to do it? :)

thanks
 
Vitrual Host is something what tells apache where a domain must be located to, like: www.cooldomain.com to /home/user/domains/cooldomain.com/public_html/

That vitrual hosts does directadmin create by itself.

You wan't something special that isn't available in directadmin at this moment so you have to ask your hosting company to set it up for you.

Your hosting provider should not get pissed up because it is not using an "special" option of apache.

Greets
 
nopf said:
php? that would require the users actually going to a file.

I need something at the server admin level that lets one domain go through to the public_html, and the other domain route to a subfolder.
 
Hi, here is a script that should do what you require.
Change "yourdomain.com" for your 1st domain name, then insert your domain name 2 and it's location as shown below.
Place this script into your 1st domain index.html "header" and rename the page index.php. Any visitors to your domain 1 will reach the page as normal. However, any visitors to your domain 2 will be redirected. Don't forget to re-point/park domain name 2 to location of domain 1. Hope this helps.



<?php
//***** Name this script "index.php"
$requestedDomain = strtolower($_SERVER["SERVER_NAME"]);
$sendToLocation = "";
if (strstr($requestedDomain,"http://yourdomain.com")) {
$sendToLocation = "/";
}
else if (strstr($requestedDomain,"http;//yourdomain(2).com")) {
$sendToLocation = "http://yourdomain(2).com/location_or_folder";
}
else {
$sendToLocation = "/";
}
if ($sendToLocation != "/") {
print header("Location: $sendToLocation");
}
?>
<!-- PLACE YOUR HTML CODE BELOW THIS LINE -->
 
Back
Top