Hi guys
I must insert in a html site a htaccess file that create a redirect 301 to
the site home page for every page that gives error 404 (Page not found), but
without affecting the single redirect 301 already present in the file
htaccess regarding other subpage moved and renamed in the past.

The purpose of all of this is not losing the google page rank that can be
passed trough every bad written back link .

What do I write in the htaccess file to do this? Do I have to write it
before or after the existing rules?

Usually I have only one or two error 404 for months to redirect: I wouldn't have to have a penalty for duplicate pages, isn't it?

Thank you

__________________
<URL SNIPPED>

in the .htaccess file ErrorDocument 404 /

but you lose the google pagerank?

Google webmaster central, a preferred response for 404 not found errors
http://googlewebmastercentral.blogspot.com/2008/08/farewell-to-soft-404s.html
prefer a redirect to a 404 page, a 404 error page does not negatively impact SER

in many sites the 404 error page has a
timed redirect to the menu
or a
click here to access menu button.
or a
sitesearch box populated with 'did you mean'
or
all of the above

ErrorDocument 404 /notfound.php

this seems to work for me notfound.php

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="Language" content="en-US">
<meta http-equiv="content-Script-Type" content="text/javascript">
<LINK rel='StyleSheet' HREF='/style.css.php' TYPE="text/css" MEDIA='all'>
<script language="javascript" type="text/javascript" src="/script.js.php"></script>
<title>File Not Found</title>
</HEAD>
<body style='margin:70px;'>
<a class='log1'> ErrorDocument 404 notfound</a>
<p>File not found<BR>The requested resource or page <?php echo $_SERVER['REQUEST_URI']; ?> is not available<BR>
or<br>
Direct linking to this page is not available.<br>
Page names on this site may alter as information changes,<br>
Bookmarks may no longer be accurate,<br>
or <u>we</u> may have broken a menu link</p>
<p><a class='button' href="/">Click here</a> to open menu pages</P>
<p style='margin:100px; margin-top:0px;'>Site Search:
<div style="text-align:center; font-size: 90%;">
<a href="http://search.freefind.com/find.html?si=******&amp;m=0&amp;p=0">sitemap</a> &nbsp;
<a href="http://search.freefind.com/find.html?si=******&amp;pid=a">advanced</a>
<form action="http://search.freefind.com/find.html" method="get" accept-charset="utf-8" target="_self">
<input type="hidden" name="si" value="******">
<input type="hidden" name="pid" value="r">
<input type="hidden" name="n" value="0">
<input type="hidden" name="_charset_" value="">
<input type="hidden" name="bcd" value="รท">
Search for <input style='padding:5px; text-align:left;' type="text" name="query" size="25" value='<?php echo $_SERVER['REQUEST_URI'].' '; ?>'>
<input style='border:2px; border-color:#a4a4a4; background:#cccccc; text-enhance:bold; padding:2px;' type="submit" value="Search">
</form>
<span style="text-align:center; font-size: 90%; padding:4px;">
<a style="color:gray;" href="http://www.freefind.com">
search engine by
<span style="color: #606060;">
freefind
</span>
</a>
</span>
</div>
</p>
</body>
</html>

a freefind searchbox, the form on the bottom, populated with the not found filename, works ok

all clear now
i go to try
thanks
bye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.