Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been unable to find an answer via search.

I have a website (I do not administer the servers) where the server will serve a different file than the one requested. I first noticed this when using a filename of the following form:

_foo.php (single underscore)

If I request foo.php (does not exist), the server returns _foo.php. By "returns" I mean that the server decides I meant _foo.php, processes the php file, and serves the output.

If I request afoo.php, zfoo.php, or even __foo.php (two underscores) (these files do not exist) the server returns _foo.php.

If I request aafoo.php, the server returns 404.

To sum up: the server seems to be doing a partial filename match.

My question is: what is happening and is this accepted behavior for a web server (or standard behavior of a common mod/package/etc)?

share|improve this question

closed as off topic by Michael Hampton, Magellan, mdpc, John Gardeniers, Iain Oct 14 '12 at 12:25

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Doesn't sound normal to me. Contact the system administrator. – Michael Hampton Aug 28 '12 at 19:21
What do you mean by "returns with _foo.php"? web servers return content, not file names. What are the HTTP request and response? For PHP files, web servers generally return the result of the interpretation of the PHP code, not the files themselves. – sch Aug 28 '12 at 20:09
@sch: By "returns" I mean that the server decides I meant _foo.php, processes the php file, and serves the output. (added this to question) – horatio Aug 28 '12 at 20:28
Please indicate what web server you're running - is it IIS/Apache/Other? – thinice Aug 28 '12 at 21:30
I hope this doesn't get closed because it's actually a pretty good caveat for those who don't know about mod_speling . – thinice Aug 28 '12 at 21:31

Sounds like your web host has mod_speling running.

A phpinfo() page will show if the module is loaded in apache or not, or you could blindly try this directive in an .htaccess file

<IfModule speling>
    CheckSpelling Off

(I didn't check the above ifModule statement.... be warned!)

share|improve this answer

You would have to talk to the server administrators to get a definitive answer. We don't know what they setup and you won't be able to provide definitive information for anyone to identify the problem. However, yes, it is possible they have rewrite rules and other mechanisms in place that may be causing this.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.