Forum Moderators: open

Message Too Old, No Replies

change url based on current url

look at the url and change to new location based on query

         

tigger2577

7:21 pm on Oct 5, 2004 (gmt 0)

10+ Year Member



I am working on trying to get my website to manage 2 different sites within one website since I am using Windows 2000 pro with IIS and it will only allow me to have one website. hence my problem.

Right now when you can reach my server my www.server.com and www.mycomputer.com the www.server.com is the main website and the www.mycomputer.com is a second website I need to maintain. I am trying to solve this problem by using a JavaScript that will load in the default page. This script will allow look at the current url and say if I am www.mcomputer.com the go to www.mcomputer.com/someware else it will load the main page for www.server.com

Here is what I have come up with so far

<script language="JavaScript">

if (parent.name = "www.mycomputer.com")
}
window.location = "/someware"
}
</script>

this will move all of the requests from eather www.server.com or www.mycomputer.com to the someware folder. What have I done wrong

BlobFisk

11:25 am on Oct 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, tigger2577!

This may be better done at the backend, but for javascript you'll need to use location.href:


<script type="text/javascript">

if (location.href == "www.mycomputer.com") {
location.href = "www.newurl.com/someware";
}
</script>

HTH

tigger2577

12:57 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



I have tryed what you have sugested and it always moves me in to the new location.

You had sugested that it would be better if I handled this in the back end. What do you mean?

upside

1:29 am on Oct 7, 2004 (gmt 0)

10+ Year Member



On the backend, means utilizing a server-side programming language such as Perl, PHP, ASP, or other.

What have I done wrong

It would be a lot better to just get a second virtual hosting account than start messing around with virtual virtual hosting like this guys:

[webmasterworld.com...]