Forum Moderators: open

Message Too Old, No Replies

Page redirect, depending on url used to access

         

itguy reggie

3:20 pm on Oct 7, 2009 (gmt 0)

10+ Year Member



Hi guys,

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..

itguy reggie

3:25 pm on Oct 7, 2009 (gmt 0)

10+ Year Member



Might add that I'm currently using either of the following code to redirect which works for 1 instance..

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>

Ocean10000

3:41 pm on Oct 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One of the easiest ways is to point all of the domains to one ip. And setup websites for each domain you wish to redirect, which corresponds to the hostnames.

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.



Is this for a internal website, or is this for a internet facing website? I have a feeling that you are being requested to handle a multiple domain website (parked domains), which will forward on the request to the finial destination. And if this is the case I think the second way would be the best way for you in the long run.

itguy reggie

3:49 pm on Oct 7, 2009 (gmt 0)

10+ Year Member



Thanks for the quick response..!

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..

marcel

4:05 pm on Oct 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've actually alrady gone down the route of a site per hostname but don't have multiple IP's to work with

You can have all of your websites 'listen' to a single IP address, each with their own Host Header, no need for seperate ports.

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]