301 Redirects

J

John

Hi,

I'm tryring to do a 301 Redirect between a couple of pages but having no
joy. The code I have been given is in ASP (see below)

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location",
" http://www.newlocation.com/here.htm"

I know to put my URL instead of www.newlocation.com/here.htm, can anyone
tell me if the code is correct and or what I am doing wrong please (and
where the code should go exactly!).

Cheers in advance!

John
 
P

p c

Not sure what's the problem, but

1. You must name the page with a .asp extension, e.g. , 301.asp
2. For your URL if it's on the same server/site, you can specify it as
root relative, e.g., "/errors/301.asp"


How do you know that that, the user will get a 302 and not a 404 error
(page not found)?

If I were you I would do a re-direct page for those pages whoch will
take them to the new page. To do it, just create pages with the same
name and the old location and add this directive between the meta tags
like this:

<META HTTP-EQUIV="Refresh"
CONTENT="5; URL=mynewpage">

The "5" means to wait 5 seconds before redirecting. The "mynewpage"
after "url=" is the URL of the page to which to redirect. In the main
text of th ebody you can add a message about the new URL.

If the page is .asp, you can do the redirect without the wait.
<%
response.redirect ("mynewpage")
%>
You should also put this line
<% Response.Buffer = True %>
at the top of your file (in HTML), needed for IIS4 and IIS5.

...PC


Response.Buffer = True
 

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

Top