Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP Redirects

Status
Not open for further replies.

gbaughma

IS-IT--Management
Staff member
Nov 21, 2003
4,772
US
Well, after some searching, I figured out how to do this.

I've been running DotNetNuke (which I *REALLY* like), but I was having some issues... see, DNN installed under a virtual directory /home and that was fine, until I started playing with some subdomains. In other words, it worked fine with a redirect...


Code:
<%
Response.Redirect ("[URL unfurl="true"]http://www.mydomain.com/home")[/URL]
%>

HOWEVER, when I added a sub-domain....

and

... that redirect no longer worked. I needed to do some stuff with the HTTP headers. Here's what I did.

Code:
<%@ Language=VBScript %>

<%

foo = Request.ServerVariables("HTTP_HOST")

Select Case foo
    Case "[URL unfurl="true"]www.mydomain.com"[/URL]
        Response.Redirect ("[URL unfurl="true"]http://www.mydomain.com/home")[/URL]
    Case "support.mydomain.com"
        Response.Redirect ("[URL unfurl="true"]http://support.mydomain.com/home")[/URL]
    Case Else
        Response.Write "I'm not sure where you want to go.... <a href='[URL unfurl="true"]http://www.mydomain.com'>Try[/URL] This instead</a>"
End Select



 %>

Since DNN takes care of the hosts (it calls it "portals"), this works great, even though both are essentially redirecting to the exact same location.

HOWEVER, you could also use this to redirect to regular pages... for example

support.mydomain.com --> foo.mydomain.com -->
:)



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top