views:

10

answers:

1

Hi!

I have a little problem with my apache2 and .htaccess rules.

for example:
I have a shortened uri like

www.domain.tld/sitemap  

which has to be rewritten by a rewriterule, redirected in a php File to display the sitemap. The problem is, that in the root folder a file named sitemap.xml exists. My apache automatically calls the sitemap.xml file but i don`t want that. The file should be only called when uri is

www.domain.tld/sitemap.xml

is there a possibility to avoid the call of this file when the shortened URI is called?

this is just an example. There are some files that are required to be in the root folder and can`t moved from there into a subfolder (which would be the easiest way to fix this problem, but its not possible in my situation). it is required that these files are callable by uri.

Has anyone an idea how to fix this problem?

my current .htaccess file

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php?urlseg=%1&%{QUERY_STRING} [NC,L]

Thanks a lot!

A: 

You likely have MultiViews enabled, which auto-resolves your non-existent resource /sitemap to the existent resource /sitemap.xml. Especially in cases where you're using mod_rewrite, I really see no need for MultiViews, so you can turn it off by adding this to the top of your .htaccess file:

Options -MultiViews

Doing so should hopefully prevent this from happening.

Tim Stone
now it works as needed!thank you very much!!
Michael R