Jump to content

Apache automatically adds .php extension to URLs that don't have it


Recommended Posts

I'm stumped here... I'm running Apache 2.2 on SuSE. It's somehow automatically adding the .php or .cgi extension when I leave it off the URL, but I don't want this to happen.

 

That is, if I request "/contact", and I have no such directory or file called "contact" but I do have /contact.php, then the server translates my request to /contact.php. Naturally this breaks all the relative links in that page when the request is actually something like "/contact/main.php". It's a problem because I'm rearranging the site and I actually have links like this that should be broken but are returning content instead, with incorrect relative links. (I can turn off AcceptPathInfo, but the server still accepts "contact" for contact.php.)

 

As far as I can tell, I don't have any mod_rewrite rules set up, so I can't tell where this "feature" is coming from or how to turn it off. The only clue is that this translation happens for .php, .cgi, and .html, but not .shtml... and I get a "Content-Location" header in the HTTP response showing the correct filename where the content is actually stored.

Thanks, disabling mod_negotiation fixes the problem.

 

According to the docs, the MultiviewsMatch directive controls this behavior of mod_negotiation. With "MultiviewsMatch NegotiatedOnly" set, it shouldn't be doing this, as far as I can tell, but it still is. Guess I'll just leave the module disabled.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.