HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 1999, 01:38 PM
Marcello
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old December 30th, 1999, 06:02 PM
cbolt
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
<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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Redirecting to subfolders on URL basis

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap