homepage Welcome to WebmasterWorld Guest from 23.23.57.182
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Transforming a 404 Error into a 301 Redirect to the Homepage?
NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 5:34 pm on Mar 8, 2010 (gmt 0)

Hello,

How can I transform a 404 Error into a 301 Redirect to the Homepage?

I've tried doing the following in .htaccess but it produced a 302 Redirect to the Homepage (the space after "http" is on purpose):

ErrorDocument 404 http ://www.mysite.com

I don't have anything else in my .htaccess file except the above.

Thanks.

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 7:29 pm on Mar 8, 2010 (gmt 0)

Your current solution is SEO suicide. Remove it immediately.

Is this for one URL, or for a range of URLs, or for all pages that do not exist?

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 3:20 pm on Mar 9, 2010 (gmt 0)

What do you mean it's "SEO suicide"?

The solution I need would be for ALL pages that do not exist.

I recently made a change to my website and want to make sure I take advantage of the PR juice that was flowing into the old pages by redirecting it to the main page (otherwise it goes to waste on a 404 error).

What do you suggest?

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 6:25 pm on Mar 9, 2010 (gmt 0)

Adding a 302 redirect to your root index page as a solution to URL requests for pages that do not exist is suicide.

Your obsession with PageRank is blinding you to other problems, problems that will more than negate any positive effect the links might have given you.

For pages that do not exist, show your 404 error page with a direct HTTP 404 status code. On that page link to the root page and to the main sections of your sites.

For specific non-existent URL requests, you could set up a 301 redirect pointing to a content page with similar or related content to the ones that no longer exist. It is bad form to redirect such URL requests to the root of a site.

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 6:52 pm on Mar 9, 2010 (gmt 0)

Thank you for your reply, but you did not explain why it is "SEO Suicide"?

Also, what problems am I being blinded from?

Thanks.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 7:18 pm on Mar 9, 2010 (gmt 0)

The HTTP 302 status code is "found" or a "temporary redirect".

Using that you will have multiple duplicate content issues; your index page indexed under an infinite number of URLs.

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 8:15 pm on Mar 9, 2010 (gmt 0)

g1smd, this is why my original question was:

How can I transform a 404 Error into a 301 Redirect to the Homepage?

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 8:25 pm on Mar 9, 2010 (gmt 0)

A 301 redirect to the root homepage for large numbers of URLs also isn't a very good idea.

It's far better to correctly serve a proper 404 error page, one which includes links to the root page, major site categories and selected content pages.

I only use a 301 redirect to redirect non-existent URL requests to another internal page with content that closely matches the content that was on the page that no longer exists.

Apologies for not getting to the root of the problem in the first couple of posts. I've dipped in and out of several threads covering similar topics during the day.

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 10:55 pm on Mar 9, 2010 (gmt 0)

That's alright, g1smd, I know how it is.

But back to my question, how would I go about accomplishing that which I seek?

Thanks again.

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 2:04 am on Mar 14, 2010 (gmt 0)

Anyone?

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 10:09 pm on Mar 14, 2010 (gmt 0)

Yes, don't mess about with the HTTP protocol. As previously-posted:
For pages that do not exist, show your 404 error page with a direct HTTP 404 status code. On that page link to the root page and to the main sections of your sites.

For specific non-existent URL requests, you could set up a 301 redirect pointing to a content page with similar or related content to the ones that no longer exist. It is bad form to redirect such URL requests to the root of a site.

I'd add that a link to the site-search facility would be helpful as well, if applicable.

(And my SEO hat is by no means a pristine white...)

Jim

NeedExpertHelp

5+ Year Member



 
Msg#: 4093411 posted 5:24 pm on Apr 12, 2010 (gmt 0)

Hi again,

I still haven't received an answer on how to transform the 404 Error into a 301 Redirect to the Homepage.

I have thousands of dead incoming links to my recently-changed website and I want to make sure all that PR is passed to the homepage instead of going to waste.

Let's face it, those thousands of external pages aren't going to change their links and there is no way to intelligently redirect those incoming links as the new site is 100% different to the old site.

The only way I can catch all that PageRank is to redirect 404's to the homepage.

So how would I do that?

Please help. Thanks!

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4093411 posted 2:14 pm on Apr 13, 2010 (gmt 0)


# Declare proper error pages for 404-Not-Found and 410-Gone
ErrorDocument 404 /local-path-to-proper-404-error-page.html
ErrorDocument 410 /local-path-to-proper-410-error-page.html
#
# Doctor-assisted duplicate-content suicide (and inefficient, as well)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(html?|php[0-9]{0,2$)} http://www.example.com/? [R=301,L]

As shown, the rule looks only for .htm, .html, and .php URLs. Add more "filetypes" only if needed, as this rule invokes a call to the operating system, possibly resulting in a physical disk read. It won't be very fast in that case...

I suggest that you do not implement this code, but rather allow your 404 and 410 error pages to harvest the link-juice and pass it on to your home page, your major category and product index pages, your HTML sitemap page, and your site-search page, as applicable. Only known-relevant URLs providing the very most "link-juice" should be redirected, and those to specific, relevant replacement pages. This code violates the spirit of the HTTP protocol, and search engines will understandably be quite wary of the results. I would not expect results to be as good as those of a proper "specific replacement-page plus 404/410 for the rest" implementation.

In the future, carefully "design" your URL-structure on new sites so that you need never change URLs again; Like it or not, search engines consider the Web to be a library with permanently-titled books, not a street-corner newspaper and magazine stand where the titles and content change daily.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved