Forum Moderators: phranque

Message Too Old, No Replies

Please critique .htaccess - 404 problem?

.htaccess review for 404 and redirect issue

         

danv

9:26 am on Apr 14, 2006 (gmt 0)

10+ Year Member



Could someone tell me if this short .htaccess file looks good? Below is the .htaccess file for my root.

I think I have these issues at least:

1. Someone said I am not returning a proper 404? I am currently directing people who type in invalid pages to a custom 404 page which works fine but maybe a server header issue?
2. When you remove a folder permanently -like I did - what are best practices? Just direct to the 404 custom page or return a code somehow? and why?

--- .htaccess ------

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

AuthName domain.com
ErrorDocument 403 /v-web/errdocs/403.html
ErrorDocument 401 /v-web/errdocs/401.html
ErrorDocument 500 /v-web/errdocs/500.html
ErrorDocument 400 /v-web/errdocs/400.html
ErrorDocument 404 [domain.com...]

Redirect 301 /web-site-design.shtml [domain.com...]
Redirect 301 /web-site-promotion-services.shtml [domain.com...]

----------------

Does anyone have good resources to help me make sure the .htaccess is setup right and so I know it is working so Google can crawl regularly and deeply?

Thanks!

jdMorgan

1:15 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Someone said I am not returning a proper 404?

Certainly, you are not. This syntax will return a 302-Moved Temporarily status, as described in the ErrorDocument documentation [httpd.apache.org]:


ErrorDocument 404 http://www.domain.com/404error.htm

Use a local URL-path only, as in

ErrorDocument 404 /404error.htm

or possibly

ErrorDocument 404 /v-web/errdocs/404.html

> When you remove a folder permanently -like I did - what are best practices?


ErrorDocument 410 /v-web/errdocs/410.html
Redirect gone /path_to_removed_folder_or_file

Jim

danv

12:28 pm on Apr 15, 2006 (gmt 0)

10+ Year Member



Thanks Jim!

The folder is indeed gone and all the web pages inside the subdomain.

If I don't use your code for folder gone, won't they just get a regular 404 error code and my new changed 404 missing resource custom error page? Isn't that enough? so Google will remove this from their index?

I guess I would like to understand why folder permanenly gone is better then document not found and how that relates to SEO and indexing.

thanks.

danv

1:11 pm on Apr 15, 2006 (gmt 0)

10+ Year Member



I forget to ask if I should set a custom server header like in the error404.php file that I did.

like:

<?php header("HTTP/1.0 404 Not Found");?>

The redirect seems to set the 410 error code though when I check a server header checker too.

So I guess that's it.

thanks again.

jdMorgan

2:16 am on Apr 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A 404 means, "Missing for an unknown reason. Might come back, might not."
A 410 means, "This resource has been intentionally removed, and will not return."

The latter will often get dead URLs out of search engines faster, since you explcitly state that you've nuked that URL on purpose.

Jim