301 redirect

G

Gpr0496

Exactly how do you get a 301 redirect to work....i have researched for the
last few hours, and am having no luck. The code I found for a windows based
server is
<%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.newdomain.com/page.html"
Response.End
%>
or
<%
If (InStr(Request.ServerVariables("QUERY_STRING"), "oldpage.htm") <> 0) Then
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "newpage.htm"
Response.End
ElseIf (InStr(Request.ServerVariables("QUERY_STRING"), "oldpage2.htm") <> 0)
Then
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "newpage2.htm"
Response.End
Else
Response.Status = "404 Not Found"
End If
%>

Which code is correct and what do I do with it? Do I add the script on the
page that I want to redirect (if so, exactly where do I place it, or do I
create a new page?. If I create a new page, what do I save it as? All of my
files are htm. Help!!!!! Thanks again.....
 
G

Gpr0496

Sorry about that....didn't receive confirmation that post went through, so I
posted again......thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

redirect 301 2
301 Redirects 1
301 redirect 2
OFF-TOPIC how to do a 301 Redirect? 3
301 redirect 6
Auto Redirect 3
How can I redirect to a URL? 0
Problem with using Login.inc and Frames Pages 1

Top