Click to See Complete Forum and Search --> : 301 redirect
Help!! I am trying to use a 301 redirect.....I am using a windows server w/asp. My pages consist of all html code. I want to change several file names and want to redirect each webpage to a new webpage. But exactly how is this done? What code do I use and where do I place the code?...in my old page which is saved as a htm file, or do I have to create a new page and save it as an asp file? (where in the page do I place the code?) Thanks for your help...I need it badly....
jvanamali
10-07-2006, 06:33 AM
U can redirect using any server side script such as asp,php etc
In asp you can use
Response.redirect ("newpage.htm") at the top of the page but for this you need your old page to be an asp page
but since you have html pages only you can use javascript to redirect to new page
write a function in javascript and call it on body onload
function fnLoad(){
window.location.href = "newpage.htm"
}
or use
<META http-equiv="refresh" content="0; URL=newpage.htm">
in between the <head> tags
where 0 is seconds before redirecting
what do you mean call it on body onload...I don't want to use the meta tag refresh....frowned upon as spamming....would this code also be frowned upon? what are my options? Since I already have these old pages indexed, and written in html, is there any way to use a 301 redirect? thank you!!
jvanamali
10-07-2006, 01:28 PM
<body onLoad=fnLoad()>
the above code calls a javascript function when a page is loaded
for 301 redirect you can use the below links
http://www.webconfs.com/how-to-redirect-a-webpage.php
http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm
you can use IIS Redirect since yours is windows based system
I gave you 2 options in the last post and 301 is the third that you are instrested in
Metarrefresh is not a search engine friendly option.
The problem with java script thing is that it only works if javascript is enabled in the client browser.
301 redirect is more search engine friendly, actually don't have much practical knowledge on it, but from what i have read it is the best option.
<Eddie>
10-08-2006, 10:57 AM
To do a 301 on a Windows server you need access to the services console which you probably don't have so you'll need to use ASP instead.
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", " http://www.new-url.com"
%>
If you only have HTML then either investigate IIS rewrite or sadly use one of the less supported versions such as META refresh or JavaScript.
I tried asp, but no luck...is this because all of my files were saved as htm and not asp? I even tried saving one of my old files as asp (the one I want to change its name) and renamed the file with its updated name and saved as htm. When I place the code:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.domain.com/newpage.htm"
>
(replacing domain and newpage with current names)
and save it in the old page, the page is not forwarded to the new page. I can't figure out why...Could it be I am placing the code in the wrong place...where should the code be placed? Thanks for your help!!