smallcompany - 4:27 pm on Apr 16, 2012 (gmt 0)
Can anyone shed any light as to how I can convince my server to throw a 404 for requests like this:
How is your PHP configured? What many call garbage after slash is what PHP uses in certain (or many) situations.
If you do not use that characteristic of PHP, you should turn it off, as per g1smd:
Make sure you have AcceptPathInfo off.
This is a headache that caused me post a lot in both Apache and PHP forums. My problem was that wherever PHP was configured as CGI (on shared hosting plans) I had trouble when calling on PHP (AcceptPathInfo settgins in .htaccess were ignored).
On servers where PHP was configured as Apache, AcceptPathInfo off did the work.
Did you post your whole .htaccess here?
In my case, this happens only if I use AddHandler or AddType directives to parse HTML as PHP.
If I comment them out, I get 404 as I want.
Take a look into your server configuration (you said VPS). IF you have the full control, then httpd.conf is the place to start I believe.
One of my sites lost PR on all of its pages (except home) because of this. When I finally turned AcceptPathInfo off on it, Google ended showing over 70k non-existing pages in WMT. I started serving 410 for all of them as they never really existed, so 301 was not something I liked.
Now, the numbers are slowly going down in WMT.
And it all started with a single link like this:
That slash caused all of the internal links to become like:
and it went into perpetual mode with no end until I stopped it.
In short, if you have the full control over the server, stop poking around with .htaccess and configure the server in the way so you get 404 on such requests while you have the server working in the way you want.
Then, see what kind of requests you're getting from search engines like Google, plus see if there is still an external link with trailing slash.
Then, do the fix in .htaccess (if needed) to stop 404 requests if you cannot influence the external link.