An area of my site has a folder (let’s call it “test”) with a series of sub folders having unique names, based on a six digit code. I want any incorrect queries to that folder that are only one character different from an existing url to always return a 404 error, rather than redirecting to the very similar existing url, as it does presently.
EG: if …/test/abc001/sample.txt exists, and …/test/abc002/sample.txt doesn’t, I need the second query to return a 404 rather than a redirect to the first url.
Can this be done in an .htaccess file?
An upvote goes to Pekka but I can’t really accept his answer as the correct one because, in my case at least, it wasn’t. As I commented under his solution, the correct answer was provided by my hosting company who instructed me to use this directive:
That is not to say that Pekka’s answer won’t be correct for other users facing a similar problem. The Apache reference for mod_speling states that CheckSpelling is off by default, so my hosting company are clearly overriding that default in the first place.
Anyway, thanks to those who tried to help.