Reply to topic
How can my index.html redirect - per several domain names
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
I own several domain names. All of them are mapped to the same root IP. How can I make the index.html in that root directory automatically redirect to Domain1Index.html or Domain2Index.html, etc., depending on wether the access is via www.Domain1.com or www.Domain2.com, etc ?
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 545
Location: Harrisburg, PA
Reply with quote
You wont be able to do it via regular HTML. You will have to use a programming language like ASP or ColdFusion.

You can see a Coldfusion Example in THIS thread

You can get an ASP example HERE

Let me know if you need help understanding if you are not familiar with programming.
I'm on the Foundation Plan
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
I'm on the Foundation plan. Is it possible to do it with PERL or CGI ?

..tom
JS redirect
darnold


Joined: 17 Mar 2005
Posts: 22
Reply with quote
On a foundation plan you can use javascript. Here is an example.



Code:
<SCRIPT Language="Javascript">
if ( top.location.href.indexOf( "domainname1.com" ) != -1 )
{
  top.location = "http://domainname1.com/folder1";

}

if ( top.location.href.indexOf( "www.domainname1.com" ) != -1 )
{
  top.location = "http://www.domainname1.com/folder1";

}


</SCRIPT>
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 545
Location: Harrisburg, PA
Reply with quote
Please confirm if you get this javascript version working, and I will move this post and sticky this topic for future reference since this is a frequently asked question
Doesn't seem to work
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
I tried it but it doesn't work. I have it in index.html - and it is supposed to call a different page depending on whether the sender entered www.VictoriaLeeBlair.com or www.TomBlair.org

Check it out here: www.VictoriaLeeBlair.com/index.html

thanks
JS redirect
darnold


Joined: 17 Mar 2005
Posts: 22
Reply with quote
The script is correct. It needs to be added to the head section of your html.
I added it to my site as an example. Browse to http://victoria.xclusivesites.com/ or http://tom.xclusivesites.com/
This is what I added. I modified it just slightly to make it xhtml happy but it is basically the same and both work.
Code:

<html>
<head>
<script type="text/javascript" language="javascript">
<!--
if ( top.location.href.indexOf( "victoria.xclusivesites.com" ) != -1 )
{
  top.location = "http://www.victoriaLeeBlair.com/VicsHomePage.html";
}

if ( top.location.href.indexOf( "tom.xclusivesites.com" ) != -1 )
{
  top.location = "http://www.TomBlair.org/TomsHomePage.html";
}
//-->
</script>
</head>
<body>
This content is displayed if no match was found on the domain names listed in the js script.
</body>
</html>
Thanks
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
You rock! Thanks for the all the work here. I'll check this out when I get home tonight.

..tom
Ummm - one more follow-on
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
Does Java work in the general scheme of things across the internet? How many people woudl you estimate have Java disabled or will have other problems crop up becuase of their configuration or browser - without having any idea of what is the problem?
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 545
Location: Harrisburg, PA
Reply with quote
If you are on the foundation plan, ASP is enabled as per the plan details:
http://www.hostmysite.com/hosting/foundation/

Try using the ASP link I posted a few posts up.

I'm not sure if PHP is enabled on foundation. To find out, create a page called phpinfo.php and put the following in it and run it:


Code:

<?php echo phpinfo(); ?>


If you get a big dump of stuff then PHP is enabled, and you can use the PHP code posted above as well.
javascript
darnold


Joined: 17 Mar 2005
Posts: 22
Reply with quote
JS works really well. It's great for a lot of things and very quick because it runs client side. It also works regardless of your hosting be it linux or windows. However you are correct it can be disabled and for that reason you should not rely on it for mission critical apps. For example. It is perfect for a first level of form validation but you should also use some sort of server side validation too. Javascript is commonly used all over the internet and most people do not disable it. I would go as far to say the average web user doesn't know how to or has any interest in disabling it. For the savy web guru Javascript can be disabled or even manipulated with the right tools. I say use it where you can but also use a server side script when it's important.
php
darnold


Joined: 17 Mar 2005
Posts: 22
Reply with quote
php is not enabled on the foundation plan. but using asp would be better because it is processed on the server. asp is available on the foundation plan.
thanks
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
You guys really are very helpful.

thank you so much.

tom blair
perkiomenville
Closer - but still not quite
RobinGoodfellow


Joined: 12 Feb 2007
Posts: 12
Reply with quote
Well I'm one step closer - but it goes to the default. At least it is executing the Java.

Could you look at http://www.VictoriaLeeBlair.com/

thanks again,

..tom
Connie


Joined: 26 Mar 2005
Posts: 176
Location: The Internet
Reply with quote
It doesn't look like you have something setup for http://www.VictoriaLeeBlair.com/ , so add something like

Code:

if ( top.location.href.indexOf( "www.VictoriaLeeBlair.com" ) != -1 )
{
  top.location = "AddressOfPageYouWantToLoadl";
}
How can my index.html redirect - per several domain names
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 2  

  
  
 Reply to topic