We help IT Professionals succeed at work.
Get Started

JavaScript:  Redirect a user based on their Requested URL

924 Views
Last Modified: 2010-04-21
Hey all,

I've got 2 virtual directories in the default website in IIS.  There are 2 dns records in DNS that point to the default website on the server.  In order to forward users to the appropriate virtual directory in IIS I must read the URL they are requesting and then pass them along to the appropriate virutal site.  Too bad for me I can't program to save my life...but I try.  

Here's my code.  Can someone please debug it for me and I think you'll be able to understand the logic here.  There are 2 virtual directories.
WWPRD
ReQLogic

They each have a DNS record that points to the same default website IP
wwhus    ==> 10.10.12.81
requs        ==> 10.10.12.81

Thanks a bunch,



<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> 
if   (document.referrer = "http://wwhus.mydocmain.int") 
     location.href = "http://cltpo006.mydomain.int/wwprd";
else
     location.href = "http://cltpo006.mydomain.int/ReQlogic";
</SCRIPT>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE