Forum Moderators: phranque

Message Too Old, No Replies

Apache, PHP, and MultiViews weirness

MultiViews causes weird URL file extention substitutions

         

jtibbetts

5:14 pm on Mar 7, 2007 (gmt 0)

10+ Year Member



I've been using MultiViews and mod_rewrite on a few different servers so that I can create nice looking URLs.

e.g.

[domain.com...]

instead of:

[domain.com...]

Things have always worked with MultiViews enabled and the following mod_rewrite rule in effect:

RewriteRule ^/products/([0-9]+) /product.php?id=$1 [L]

However, I'm working on a new Apache 2 server, and for some reason ".php" extensions are being added to the URL in the *middle* of the URL.

e.g.

[domain.com...]

turns into:

[domain.com...]

So when the mod_rewrite rules are invoked, the URL no longer matches the rule.

You can make up any kind of gibberish after /products/, and apache will always serve up "products.php."

e.g.

[domain.com...]

still loads:

[domain.com...]

The weird part is that the ".php" is only added if "products.php" exists. If the products.php file is removed from the server, the mod_rewrite rule works with no problem.

Anyone know what's causing ".php" extensions to be added in the *middle* of URLs?

jdMorgan

7:53 pm on Mar 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MultiViews seeks to find the 'best match' for any requested URL that does not literally exist on the server.

AcceptPathInfo takes any URL that does not literally exist, and trims URL-path-parts off the end one-at-a-time until it finds a "part" of the URL that exists.

So, both of these can interact positively or destructively with mod_rewrite, mod_alias, etc., and as suggested above, they should be disabled unless you require them.

Jim