<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN_ALIAS") <> 0 then
response.redirect "alias-directory"
elseif InStr(sname,"DOMAIN_ALIAS2") <> 0 then
response.redirect "alias-directory2"
end if
%>
be sure to use capital letters,
if your on nix someone else will have to help you.
<?
$host = getenv(HTTP_HOST);
if ($host == "alias1.domain.com") {
header("Location: [domain.com...]
}
if ($host == "alias2.domain.com") {
header("Location: [domain.com...]
}
if ($host == "alias3.domain.com") {
header("Location: [domain.com...]
}
?>
I'm only guessing this is what you need. Hope it helps.
Copy redirect.php to your htdocs root (where index.htm lives). Test it in this new directory - does it do what you want?
Rename it index.php --- and the rename index.htm to index-old.htm or something.
As for spiders -- not exactly sure what would happen. I think it would be better for page ranks to do something in php like;
<?
$host = getenv(HTTP_HOST);
if ($host == "alias1.domain.com") {
print "custom content for alias 1"; # Open the file in dir1 and print it.
}
if ($host == "alias2.domain.com") {
print "custom content for alias 2";
}
?>
All links from this page would then be to the sub dirs.
One other thing is to check that your hosting providers don't offer this as a service already -- it is more efficient for the web server to do this work.
Good luck ;)
#!/usr/bin/perl
# Domain Name Redirect To URL
#
%Domain_Names = (
"domain_alias1.com" => "http://domain_alias1.com/proper_page1.htm",
"domain_alias2.com" => "http://domain_alias2.com/proper_page2.htm");
$Default_URL = "http://www.main_domain.com/home.htm";
foreach $line (keys(%Domain_Names)) {
if ($ENV{'HTTP_HOST'} =~ /$line/i) {
print "Location: $Domain_Names{$line}\n\n";
exit;
}
}
print "Location: $Default_URL\n\n";
Thanks again everybody for all of your expertise!!!