I have a site installed with clean URLs and URL aliases - it is working fine. So http://www.example.com/home (which is valid page) works as expected. Also if a URL is incorrect, doesn't have a page, such as http://www.example.com/homes (s on the end) the site correctly brings up my custom 404 page.
All good; however 'non-clean' URLs still work, and worse. So:
1) "http://www.example.com/index.php?node=1" : brings up the page which is aliased to /home. OK I can live with that, it is a valid node/page.
2) "http://www.example.com/index.php?node=4000000" : which valid Drupal 'syntax' but it is NOT a valid node/page brings up the home page instead of the 404 page. It is not a valid page/node.
3) Worse, "http://www.example.com/index.php?totalgarbage" : which is, garbage, also brings up the home page even though it does not exist either as a clean, aliased URL or a Drupal non-clean URL. It is junk.
This is a real problem. Reason being, apart from the fact that I do not want junk URLs going to the home page, they should 404, that I took over an existing site and migrated it from another CMS which used non-clean URLs, everything was in ugly form like "~/index.php?SomeLongURLNameText". Now I see that some search engines still continue to troll for these old URLs which, because they bring up the home page, never return 404 errors.
Is there some setting I have missed in Drupal, any way to have these junk non-clean URLs fail to 404 page?
Comments
Error reporting
Check your settings at admin/settings/error-reporting.
I have custom pages (page names 403 and 404) for my error pages. I have added them to the proper area in the error-reporting and everything works.
I hope this helps
James
Error reporting custom pages configured
Hi thanks for reply - I have custom pages for both 404 and 403 errors defined on the Home › Administer › Site configuration screen and they are working fine. The issue is if someone type in a non-clean URL like this "http://www.example.com/index.php?totalgarbage" - so it has "?" followed by anything - then the home page loads.
If a garbage URL is typed in, and node/page/alias does not exist then I want Drupal to return, as it should, a 404 error.
I see
I have recreated this on one of my sites and will see what I can find. I would like the fix as well.
James
Patrick, I think you have
Patrick, I think you have found a bug with the path module. You might want to open an issue at http://drupal.org/node/add/project-issue/path
The guys there will be the best people to talk to.
James
any info on this?
solution?
Anyone who gives another a cold cup of water certainly will not lose his reward!
any solution found to this?
I also migrated my site to a whole new layout and I want Drupal to return 404 for non-existant pages so that search engines remove them from their cache. As it is whenever they hit my old links they get my default page not found and so they keep my old link in their cache.
Drupal ought to let us specify on the 'admin/settings/error-reporting' page for 'page not found' errors that we actually want to return a 404 instead of redirecting to drupal page.
Anyone who gives another a cold cup of water certainly will not lose his reward!