automatic redirection script for old pages?

  • nuflo
  • Novice
  • Novice
  • User avatar
  • Joined: Mar 15, 2004
  • Posts: 18
  • Loc: new york
  • Status: Offline

Post April 12th, 2004, 12:08 pm

hey all. anybody know of a script that i could put on the top of old pages to automatically open up my index page so old search engine links don't lead people to pages that have old dead links and missing images files? i don't want to delete them becuase the search engines have already crawled them and they come up in searched, i just want those pages to automatically revert to the index page. does such a think exist? and or is this wise?
thanks for any advice people of ozzu land!!
peace
ian
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 12th, 2004, 12:08 pm

  • Axe
  • Genius
  • Genius
  • User avatar
  • Joined: Jan 07, 2004
  • Posts: 5744
  • Loc: Sub-level 28
  • Status: Offline

Post April 12th, 2004, 12:27 pm

I just use a PHP file...

Code: [ Select ]
<?php
 header("HTTP/1.0 301 Moved Permanently");
 header("Status: 301 Moved Permanently");
 header("Location: http://www.yourdomain.com");
 exit;
?>
  1. <?php
  2.  header("HTTP/1.0 301 Moved Permanently");
  3.  header("Status: 301 Moved Permanently");
  4.  header("Location: http://www.yourdomain.com");
  5.  exit;
  6. ?>


Then just save it out as whatever your old file was called.

Of course, if you're using .html files, you can't put PHP code inside 'em (unless your host is configured to parse EVERYTHING for PHP code)...

But what you can do, is save the code above as error404.php

Then set it up as the default error document in .htaccess

Code: [ Select ]
ErrorDocument 404 /error404.php
  • nuflo
  • Novice
  • Novice
  • User avatar
  • Joined: Mar 15, 2004
  • Posts: 18
  • Loc: new york
  • Status: Offline

Post April 12th, 2004, 12:35 pm

i'll mess with it and see if i can make it work. thanks for the help!
peace
ian@nuflo
  • musik
  • Legend
  • Super Moderator
  • User avatar
  • Joined: Aug 06, 2003
  • Posts: 6892
  • Loc: up a tree
  • Status: Offline

Post April 12th, 2004, 3:39 pm

I use this code, works pretty quick.


Put this in the head section:
Code: [ Select ]
<script language="JavaScript">
<!--
function MM_goToURL() { //v2.0
 for (var i=0; i< (MM_goToURL.arguments.length - 1); i+=2) //with arg pairs
  eval(MM_goToURL.arguments[i]+".location='"+MM_goToURL.arguments[i+1]+"'");
 document.MM_returnValue = false;
}
//-->
</script>
  1. <script language="JavaScript">
  2. <!--
  3. function MM_goToURL() { //v2.0
  4.  for (var i=0; i< (MM_goToURL.arguments.length - 1); i+=2) //with arg pairs
  5.   eval(MM_goToURL.arguments[i]+".location='"+MM_goToURL.arguments[i+1]+"'");
  6.  document.MM_returnValue = false;
  7. }
  8. //-->
  9. </script>



And this in the HTML:
Code: [ Select ]
<body bgcolor="#FFFFFF" onLoad="MM_goToURL('parent','http://www.yourwebsiteaddress.com/');return document.MM_returnValue">
Opportunity To Do - Changing the lives of children around the world.
Rose.id.au - Doing Life.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post April 12th, 2004, 3:47 pm

:D
Code: [ Select ]
<html><head>
<script language="javascript">
window.location="http://www.google.com";
</script>
</head></html>
  1. <html><head>
  2. <script language="javascript">
  3. window.location="http://www.google.com";
  4. </script>
  5. </head></html>
Strong with this one, the sudo is.
  • musik
  • Legend
  • Super Moderator
  • User avatar
  • Joined: Aug 06, 2003
  • Posts: 6892
  • Loc: up a tree
  • Status: Offline

Post April 12th, 2004, 3:49 pm

:roll:
Opportunity To Do - Changing the lives of children around the world.
Rose.id.au - Doing Life.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post April 12th, 2004, 3:59 pm

:D ASP
Code: [ Select ]
<%
Response.Redirect("http://www.google.com")
%>
  1. <%
  2. Response.Redirect("http://www.google.com")
  3. %>


Replace Google with your url of course, I just use it for examples and testing becouse it loads faster than just about anything.

I know, I tend to take all the fun out of things :roll:
Strong with this one, the sudo is.
  • musik
  • Legend
  • Super Moderator
  • User avatar
  • Joined: Aug 06, 2003
  • Posts: 6892
  • Loc: up a tree
  • Status: Offline

Post April 12th, 2004, 4:02 pm

oh lol fair enough :)
Opportunity To Do - Changing the lives of children around the world.
Rose.id.au - Doing Life.
  • Vaclav
  • Born
  • Born
  • No Avatar
  • Joined: Apr 13, 2004
  • Posts: 2
  • Status: Offline

Post April 13th, 2004, 5:16 am

In fact you do not need script, a meta will do:
<meta http-equiv="refresh" content="10;url=http://www.new.com">
Leave 10 secs for the redirect, otherwise search engines may spot this as a cloaking technique.

Best way is to use server redirect: 301 Moved Permanently.
  • nuflo
  • Novice
  • Novice
  • User avatar
  • Joined: Mar 15, 2004
  • Posts: 18
  • Loc: new york
  • Status: Offline

Post April 14th, 2004, 2:33 pm

you guys rock.
peace
ian@nuflo
  • LordArnell
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 15, 2004
  • Posts: 13
  • Loc: UK
  • Status: Offline

Post April 15th, 2004, 8:35 am

I personally have used a javascript much as the same as above especially when a group was referencing a file on my site that I had renamed and had to create some new pages just the redirection. I would leave these pages about a month or two and then remove since most search engines rescan your site every month.

Post Information

  • Total Posts in this topic: 11 posts
  • Users browsing this forum: No registered users and 118 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.