#1
  1. No Profile Picture
    Marcello
    Guest
    Devshed Newbie (0 - 499 posts)
    Can somebody please help me with this problem ?

    I have many URLs registered, but all pointing at the same address WWW.MYNAME.COM

    Is it possible to write a JS to be placed in the head wich does the following: check what is written in the URL box and redirect to a subfolder!

    ie:

    If URL=MYNAME.COM then stay on page
    If URL=ALFA.NET then goto MYNAME.COM/ALFA
    If URL=BRAVO.COM then goto MYNAME.COM/BRAVO
    .. and so on

    Sorry for this BASIC look of the code !

    I think it can be done using History(0) (or maybe -1, it depends I think). It shoulkd be in the very first lines of the page, so to redirect away asap.

    Thankyou very much for any help you can give me !
    Bye
  2. #2
  3. No Profile Picture
    cbolt
    Guest
    Devshed Newbie (0 - 499 posts)
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    if (top.location.href.search('[Aa][Ll][Ff][Aa]') > -1) {
    top.location.href = 'http://www.myname.com/alfa/';
    }
    if (top.location.href.search('[Bb][Rr][Aa][Vv][Oo]') > -1) {
    top.location.href = 'http://www.myname.com/bravo/';
    }
    //-->
    </SCRIPT>

    It has to be done this way because the .indexOf() function is case sensitive, and you can't do .toLowerCase.indexOf()... the above uses something called regular expressions so it is case insensitive. To add another url, you would just surround each letter of the word in the domain name with [ and ] then include both the upper and lowercase letter.

Similar Threads

  1. How to rewrite URL with Perl redirecting?
    By fablau in forum Perl Programming
    Replies: 5
    Last Post: January 17th, 2004, 10:50 AM
  2. redirecting url
    By brian110872 in forum PHP Development
    Replies: 1
    Last Post: January 4th, 2004, 03:48 PM
  3. redirecting to another URL on a different site
    By hllywdw in forum Java Help
    Replies: 1
    Last Post: October 1st, 2003, 05:54 AM
  4. Redirecting a request and retaining variables in the URL
    By chinook in forum PHP Development
    Replies: 5
    Last Post: October 5th, 2001, 10:44 AM
  5. Redirecting to another url
    By Jon12345 in forum PHP Development
    Replies: 2
    Last Post: September 25th, 2001, 05:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo