| re: Problem rying to Redirct Domain
Martin;
Thanks for the response. I think I am setting the target directory as you
indicated? After correcting my alert statements it turns out that the domain
retuned by location.hostname and location.href are both the same value - the
url of the site, not the url that the user typed in?
Also, if I change "location.hostname" to "window.location.hostname" it does
not seem to change anything?
Wayne
"Martin Kurz" <info@martinkurz.in-berlin.de> wrote in message
news:1125832747.935633@elch.in-berlin.de...[color=blue]
> Wayne Wengert schrieb:[color=green]
>> I have a web site to which multiple domains point and I want to redirect
>> to
>> a specific subdirectory for specific domain references. I found the
>> following script and am trying to use it but I cannot get it to work. I
>> added the alert statements to try to see what is happening but they both
>> retund a value of 0? Any ideas as to how I can accomplish this?
>>
>> Wayne
>>
>> ==============================
>> <script language="JavaScript">
>> <!--
>> alert("Location.Hostname: " & location.hostname);
>> alert("urlloc: " & location.href);
>> if ( location.hostname == "AltDomain.org" ) {
>> window.location = "/AltDomainsubDirectory/";
>> } else if ( location.hostname == "domain_two.com" ) {
>> window.location = "/users/domain_two/";
>> } else {
>> // build current content
>> }
>> -->
>> </script>[/color]
>
> First of all: location is an object, you have to set the path to the
> property href:
>
> window.location.href = "/AltDomainsubDirectory/";
>
> You should get the actual hostname bei window.location.hostname[/color] |