Skip to content

Instantly share code, notes, and snippets.

@flashtopia
Created November 27, 2012 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flashtopia/4153268 to your computer and use it in GitHub Desktop.
Save flashtopia/4153268 to your computer and use it in GitHub Desktop.
ASP Redirect Directoy
<%
'default.asp page for directory you want to redirect out of...
'options
OldVdir = "oldvdir"
NewVdir = "newvdir"
'redirect code
query_string = request.ServerVariables("QUERY_STRING")
if query_string <> "" then
query_string = "?" & query_string
end if
OldURL = "http://" & request.ServerVariables("SERVER_NAME") & request.ServerVariables("URL") & query_string
NewURL = replace(OldURL,OldVdir,NewVdir)
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",NewURL
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment