Clean URLs working, but (junk even) non-clean URLs still return home page instead of 404 error

Created on 11 December 2009, over 15 years ago
Updated 23 August 2023, over 1 year ago

Please see forum topic at http://drupal.org/node/652134. The main text of the posting is below.

Essentially problem is 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.

A Drupal member suggested to post the issue as a bug in the Path project.

8< =================== Original Post In Forum (Link Above) ===================== 8<
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.

🐛 Bug report
Status

Active

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

No activities found.

Production build 0.71.5 2024