homepage Welcome to WebmasterWorld Guest from 54.205.207.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Is it OK to redirect to index via .htaccess?
Boulder90

5+ Year Member



 
Msg#: 4087783 posted 12:59 pm on Feb 26, 2010 (gmt 0)

I'm getting a few "not found" pages on two of my sites and I found a simple redirect that seemed to work for some of these pages:

ErrorDocument 404 http://www.example.com


I was wondering if this is an SEO prudent thing to do, or if there is a better way. Also, I noticed that this redirect was not working for a bunch of the "not found" pages. These not found pages seem to be something close to the 404 error pages, but not quite. I am finding them in Google Webmaster tools and this is what I am getting:


Not Found
The requested URL /example/2006/11/27/
was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


So what I am getting is some sort of regular not found error and a 404? Thanks for any comments.

 

jdMorgan

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



 
Msg#: 4087783 posted 3:53 pm on Feb 26, 2010 (gmt 0)

This is SEO suicide.

The syntax you show for ErrorDocument above generates a 302-Found redirect, as documented for the ErrorDocument directive in the Apache core functions documentation.

Set up a proper 404 error page, with a concise explanation of the problem and links to your home page, HTML site map page, search page, and major category pages, as applicable.

When defining your errordocument, use this syntax

ErrorDocument 404 /local-path-to-404-error-page.html

The path *must* be a local path. If you define a URL, the result is a 302 redirect, as described.

Finally, get rid of those 404 errors by 301-redirecting any recognizable requests --e.g. URLs with trailing punctuation (e.g. from non-robust forum auto-linking features) to the correct URLs, return a 410-Gone response for all resources which you *know* you have removed, and simply ignore the 404 errors caused by exploit scanners, etc.

Jim

Boulder90

5+ Year Member



 
Msg#: 4087783 posted 12:54 pm on Feb 27, 2010 (gmt 0)

Thank you for your reply! I have done as you isntructed but for some reason my new 404 page will only link to itself when reached. It won't link out. Really strange. It also ignoes any CSS file I attach to it. It's also ignoring a custom image. I've placed all these things in the root folder and still no luck.
When I type in a random bad URL that I know doesn't exist on my site, such as "www.example.com/horseteeth it will link out and it looks fine. When I access one of the "not found" URLs from Google Webmaster Tools in the "not found" section, It reaches my 404 page, but the page looks awful and won't link outside of itself.

I have used this string in my .htaccess:

ErrorDocument 404 /not-found.html

and named my 404 page this: not-found.html

Thx again for your help about the SEO ramifications of just doing a redirect.


EDIT: I just realized that I am having problems with the 404 page whenever I am inside a subfolder. For example, if I type in www.example.com/pigface, the 404 page works fine. If I got to an actual subfolder and type www.example.com/parks/pigface, the 404 page doesn't recognize CSS and only links to itself. In fact, it does go place a URL in my url box when I clock a "popuar links" menu on my 404 page, but it just adds them into the URL and never goes there. In fact, If I hit another link it will add that URL to the already long doubled up URL and still remain on the 404 page, and so on and so forth. Strange.

g1smd

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



 
Msg#: 4087783 posted 7:19 pm on Feb 27, 2010 (gmt 0)

Begin links to images, CSS files, etc, with a leading slash, and follow with the /full/path/to/the/file

jdMorgan

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



 
Msg#: 4087783 posted 4:44 pm on Mar 1, 2010 (gmt 0)

That is, use only full URLs or server-relative links in the 404 page, not page-relative links. You have no idea what the URL-base might be when the 404 page is invoked, and the 404 page content effectively replaces the originally-requested page's content at that originally-requested page's URL.

So don't use page-relative linking on any error page.

Jim

Boulder90

5+ Year Member



 
Msg#: 4087783 posted 12:16 am on Mar 2, 2010 (gmt 0)

Guys, thx! I have added "/" to the front of the links and all is well now on 404 pages for my commercial site.

For whatever reason, I still can't get any 404 errors currently listed in Google webmaster tools to go to my new 404 page in my wordpress blog. I think it's because my wordprerss blog is in a subfolder, not in the root. The root 404's now go right to my new 404 page in WMT, but not any of the 404's that have anything to do with wordpress. That stinks beecause there is around 300 of them.

g1smd

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



 
Msg#: 4087783 posted 12:34 am on Mar 2, 2010 (gmt 0)

I am concerned about this 'go to the 404 page' terminology that you're using.

To be clear, if the URL in the browser URL bar changes when the 'not found' error message is displayed, then you have a 301 or 302 redirect kicking in - and this is a MAJOR problem that should not be happening.

To clarify, the 404 status code and the (optional) human-readable error message should be returned at the originally requested URL.

Boulder90

5+ Year Member



 
Msg#: 4087783 posted 7:51 pm on Mar 2, 2010 (gmt 0)

g1smd:

Thanks. The URL is not changing when my custom 404 page appears.

g1smd

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



 
Msg#: 4087783 posted 12:25 am on Mar 3, 2010 (gmt 0)

Sounds like it is OK then.

Use 'Live HTTP Headers' to confirm that the very first URL request directly receives a 404 status code in return.

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