Forum Moderators: open
While I'm not a developer, i've been asked to set up something whereby I can set up IIS to redirect to a number of different pages, depending on what url the user has inputted..
eg - user enters 'Sport' into IE address bar.. I've set DNS up to point this to my web server and it's then redirected to, say, an external site.. This works..
However, I need to set this up for multiple dns entries.. Say 'News', 'Business' etc..
I know that I can use different port numbers and make this work, but cannot use port numbers in DNS entries..
I also know that I could use different IP's on the server per site and create a site for each one..
However, none of these are really a runner.. What my manager wants is a default.html, or .asp file that will check what url the user has entered and redirect it depending on that..
Any ideas on how I can make this happen, seeing as I'm not a programmer..?
Any help would be greatly appreciated.. If it's unclear, just let me know..
Cheers,
Reggie..
ASP -
<%
Response.Redirect "external site"
%>
HTML -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Redirect</title>
<meta http-equiv="REFRESH" content="0;url=http://externalsite"></HEAD>
<BODY>
Please wait while we redirect you to the external site...
</BODY>
</HTML>
or
Setup one website to answer everything on the given ip and code up a dynamic redirect in your choice of programing languages, to do the redirects based on the hostname.
I've actually alrady gone down the route of a site per hostname but don't have multiple IP's to work with (I know it works though).. and a different port number cannot be added to each hostname in DNS..
I think your 2nd option would be best and what I'm aiming for.. I didn't know that I could use the hostname within IIS in the code.. I'll have a look at that option and find some code for dynamic redirects..
Some of the DNS entries will be for internal and some for external website.. It's just going to be used for ease of access for our users..
Thanks again,
Reggie..
I've actually alrady gone down the route of a site per hostname but don't have multiple IP's to work with
But, I agree with Ocean10000, the second option would be better in the long run. You can query the URL with Request.ServerVariables("URL"). Here are some more ServerVariables [w3schools.com]