PDA

View Full Version : redirect domain2.com to domain1.com/domain2/


nopf
04-26-2004, 06:59 PM
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?

rumrugby
04-26-2004, 07:40 PM
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?

ja3
04-27-2004, 12:22 AM
Maybe you could use php?


<?php
header("Location: url");
?>

nopf
04-27-2004, 08:10 AM
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.

ja3
04-27-2004, 08:12 AM
You can do it with apache v(itrual)hosts.

nopf
04-27-2004, 08:25 AM
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

ja3
04-27-2004, 08:32 AM
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

Swifty
05-08-2004, 11:27 AM
Originally posted by nopf
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.

Swifty
05-08-2004, 11:46 AM
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 -->