1

According to woorank.com seo tools, I read that its not best practice for a website to not have a custom 404 error page. But here's why I don't have it on a domain.

Currently I and one other person manages the contents of the domain, which includes generating and removing URLs automatically.

For example, Say the site is about food and the other person decides to add fruit to the site. Then a page is automatically generated and this URL is then created and accessible:

http://example.com/fruit

Then he adds apples and oranges. These URLs are then created:

http://example.com/fruit/apples
http://example.com/fruit/oranges

Then he adds vegetables. These URLs are then created:

http://example.com/vegetables

Then he adds carrots and celery. These URLs are then created:

http://example.com/vegetables/carrots
http://example.com/vegetables/celery

Therefore these URLs in total will exist:

http://example.com
http://example.com/fruit
http://example.com/fruit/apples
http://example.com/fruit/oranges
http://example.com/vegetables
http://example.com/vegetables/carrots
http://example.com/vegetables/celery

Later on, he decides to no longer have carrots or oranges. This means the accessible URLs are now:

http://example.com
http://example.com/fruit
http://example.com/fruit/apples
http://example.com/vegetables
http://example.com/vegetables/celery

and these ones should return status 410:

http://example.com/fruit/oranges
http://example.com/vegetables/carrots

and in an ideal sense, the rest of the URLs not listed should return 404 status.

When he decides to remove a food category or a food item, it will likely never be added again in the future.

The only way I feel I can pull this off properly is to configure mod_rewrite to return status 404 by default to URLs not listed, and the ones that recently are removed should be stored in a database so that it is checked before returning back a 404.

My line in .htaccess would look like this:

RewriteRule ^(.*)/(.*)$ /loadpage.php?foodcategory=$1&food=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^$ /homepage.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ - [R=404,L]

My question then is this...

Is it okay (standard wise) to give a page with http 410 status code for an entire domain for URLs that don't exist on it or must I give an http 404 status code for URLs that never existed before on the domain and flood my database with old URLs that are removed and give http 410 status to them?

4
  • 1
    Well thought out! A 404 or 410 is fine for any page or URL that does not exist. You do not have to mix the two. If the page is gone, then a 410 is certainly appropriate, however, a 404 is automatic and fine too. Just know that Google, for example, will try for a number of times before delisting any URL. In the meantime, it will be dropped from the SERPs for anything that does not appear to be temporary- that is, 404ed several times consistently. I would say which ever is easiest. If you can 410 all non-existent URLs, then that would be great- otherwise go for a 404.
    – closetnoc
    Commented Aug 24, 2015 at 3:45
  • your comment qualifies as an answer Commented Aug 24, 2015 at 3:51
  • Thanks Mike! I cut and pasted then added a bit more for clarification. Cheers!!
    – closetnoc
    Commented Aug 24, 2015 at 4:05
  • You seem to be mixing up the term "custom 4xx page" with returning a 4xx status. There is no reason not to have a "custom 4xx page", which is a usability feature, not a direct SEO one. "configure mod_rewrite to return status 404 by default" - you shouldn't have to do anything to return a 404 by default for non existent URLs - that should already be the default?
    – MrWhite
    Commented Aug 24, 2015 at 9:37

2 Answers 2

1

A 404 or 410 is fine for any page or URL that does not exist. You do not have to mix the two- you can chose just one.

If the page is gone, then a 410 is certainly appropriate, however, a 404 is automatic (as well as traditional as a result) and fine too. Just know that Google, for example, will try for a number of times before delisting any URL from the index. In the meantime, it will be dropped from the SERPs for anything that does not appear to be temporary- that is, 404ed several times consistently. Google will sometimes sample a page more frequently when a 404 is issued or in the case of several 404ed pages, sample a wider set to ensure that there is not a wholesale site change that it should be aware of.

I would say which ever is easiest. If you can 410 all non-existent URLs, then that would be great- otherwise go for a 404 which should be easier but require more failed attempts overall for the same effect.

0

According to Google & in the context of SEO, In case of 404, the page is retained 24 hours before being considered as deleted. In case of 410, the page is considered as deleted right away.

I guess for a big online shop it can make a difference for product pages that are gone. If the product are discontinued a 410 would be normal. In fact, it is possible to code 410 http codes for a category of pages in wordpress using php or the 410 plugin.

reference from Google: https://www.youtube.com/watch?v=xp5Nf8ANfOw

1
  • 1
    A 404 or 410 has nothing to do with SEO- these are pages that are no longer there or temporarily unavailable and therefore a normal course of business. Google must obey the same rules we do and cannot penalize a site for normal functioning. Google will delist from it's index immediately any 410 while with a 404, Google will retry the page for a period of time before delisting the page. A 410 is faster and less obtrusive for all involved and technically correct if a page is gone and not to return.
    – closetnoc
    Commented Aug 24, 2015 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.