Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Support > Redirect of non-related sites on the same server with different URLS using Javascript

Reply
Thread Tools

Redirect of non-related sites on the same server with different URLS using Javascript

 
 
UKALUM85
Guest
Posts: n/a
 
      06-24-2003
For those of you that want do it here's the code to redirect to different
sites on a server from the main page in Javascript:

<script language="JavaScript">
<!--
var dns1 = "http://mail.url1.com"
var dns2 = "http://url1.com"
var dns3 = "http://mail.url2.com"
var dns4 = "http://url2.com"
var dns5 = "http://mail.url3.com"
var dns6 = "http://url3.com"
var urlloc = location.href
var loc = urlloc.toLowerCase()

if ( loc.indexOf(dns1) != -1 ) {

location.href = "http://url1.comort"

} else if ( loc.indexOf(dns2) != -1 ) {

location.href = "http://url1.com/sitefolder"

} else if ( loc.indexOf(dns3) != -1 ) {

location.href = "http://url2.comort"

} else if ( loc.indexOf(dns4) != -1 ) {

location.href = "http://url2.com/sitefolder2"

} else if ( loc.indexOf(dns5) != -1 ) {

location.href = "http://mail.url3.comort"

} else if ( loc.indexOf(dns6) != -1 ) {

// Load Page
}
//-->
</script>

where urlx is the domain name, change mail and .com accordingly and port is
the port of the web messaging for the mailserver or alternate web server
port. Adding more urls is accomplished by incrementing the var dns lines and
adding additional if statements with the redirects.


This is what I was asking for 3 days ago, thought I'd post so others might
benefit from my research and work.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird issue, same code, same browser, two different apache servers,very different css bluebaron HTML 3 11-04-2009 07:13 PM
running same script on same data on two different machines -->different result Christopher Brewster Python 5 11-14-2008 08:19 PM
Different urls to same ws? Jukka Kenttälä ASP .Net Web Services 1 01-08-2004 08:26 AM
Distinguish text URLs from non-text URLs? Kaidi Java 5 01-04-2004 10:15 AM
same code produces different decimal symbol on different computers with same settings ASP General 2 12-29-2003 02:29 PM



Advertisments