I have this problem where all URLs like context/path/file/anything/that/follows
becomes context/path/file.php/anything/that/follows
or context/path/file.xml/anything/that/follows
.
I have the following rewrite rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^service/(.*)$ service.php?xyz=1 [L,QSA]
which should map any URL starting with service/...
to service.php
. Now, problem is, if an XML file named service.xml
is in the same folder as the .htaccess
, the URLs are mapped to that file instead. If a PHP file exists, they go to the PHP file. The XML file takes precedence, i.e. if there is both an XML file and a PHP file with the name service.*
in the directory, the XML file gets chosen.
I have PHP 5.3, Apache 2.x, on Mac OS X 10.7 (Lion). This problem did not previously occur when I had OS X 10.6, So there must be some changes in the configurations provided by Apple. I just cannot figure out what.
Is there a way I could disable this functoinality?
Or am I entirely off-track, and donig something stupid?
BTW, this does not relate to mod_rewrite, as enabling or disabling it, or removing the rewrite rule from the .htaccess
changes anything. The URL service/my/parameter
still points to service.xml/my/parameter
, even if mod_rewrite is disabled.
For now, I have just taken the query string out of the url, and parsed it manually inside the PHP file. But I know that is not the right way to do this.
This seems to be the MultiViews option enabled.
Try to add
Options -MultiViews
in the<Directory>
section (or .htaccess).