Hello, I have a multilingual site. Googlebot generates error 500 in many
case. Googlebot try any combination of parameters. It still tries to
test old urls of old websites I had in the past. To avoid this I decided
to create an if statement letting nobody enter with wrong parameters.
On one page for example I wrote this <% if params[:locale] == “en” ||
params[:locale] == “de” || params[:locale] == “fr”> (with other
parameters than en de or fr the site display itself not normally,
and with other parameters than en de fr there should be nothing to
display, as i have only a trilingual website. So if <% if
params[:locale] == “en” || params[:locale] == “de” || params[:locale] ==
“fr”, we can display the page
I display a page with the 3 existing choices to click: fr en de. This
way I avoid a 500 error of googlebot or an anormally displayed page of a
google user clicking on a bad referenced page.
BUT the problem is that “google webmaster tools” indicates now that the
website has many errors. Because wrong parameters display a page without
error instead of returning a 404 error page. Because of this I have too
many pages to crawl, as i have infinite number of pages that returns
status 200 OK.
I just would like to write something that generates the 404 error page
status, in order googlebot do not references it.
So i copy all i found on the internet for scripts to generate a 404
error status, but nothing works.
Finally i put this html script
My app is capable to generate error status in many cases, as the page
/fr/not_found, does not exist, I get the correct error message on the
website, but for googlebot it is not a 404 status as the page exists.
How could I generate a 404 error status whenever I want and if possible
in a rhtml file?
Thanks a lot for your help