0

I have a page /include/redirector.asp

The beta and www are both websites hosted on the same physical server

servername xxx OS windows 2003 IIS 6

This file exists on both my beta and production site. Here are the contents of the file.

<%
If InStr(Request.ServerVariables("SERVER_NAME"),Application("subdomain")) = 0  Then
Response.Status="301 Moved Permanently" 
Response.AddHeader "Location",lcase("http://" & Application("subdomain") & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME"))
End if
%>

What could be different between the configuration in these two sites to cause this issue?

Please help.

1 Answer 1

0

You need to use some like Live Headers for firefox.

http://www.sc-pa.com/include/redirector.asp
GET /include/redirector.asp HTTP/1.1
Host: www.sc-pa.com
User-Agent: Mozilla/5.0 Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://serverfault.com/questions/239249/same-page-behaves-differently-when-viewed-on-beta-site-vs-production-site
Cookie: ASPSESSIONIDSCQSSBBD=ADHGDHICJHBOHKAIPKGCCNIC



HTTP/1.1 301 Moved Permanently
Date: Wed, 23 Feb 2011 16:45:29 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Location: http://wwwwww.sc-pa.com/include/redirector.asp
Content-Length: 0
Content-Type: text/html
Cache-Control: private

Look at the Location its trying to redirect me to: http://wwwwww.sc-pa.com/include/redirector.asp. So you need to fix your code. But that's a question for stackoverflow, not server fault. But you're adding subdomain (which I assume is "www"), to HTTP_HOST which already contains the www.

Perhaps you should use HTTP_HOST instead of SERVER_NAME in the if clause. Either way, print out all those variables and really think about what you want to happen.

2
  • Why would it work on one server and not the other?
    – MVCylon
    Feb 23, 2011 at 16:56
  • Change the script to print out all of those values you're using. If you post them, we may be able to help.
    – Steven
    Feb 23, 2011 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .