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?