php - htaccess conflict between web route and public directory
I have a Magento project with a third-party module which creates a HTML sitemap at the /sitemap route. Meanwhile, we have a sitemap directory which contains a bunch of publically accessible XML sitemaps (published to Google etc). With the sitemap directory in place, the /sitemap route causes a redirect loop.
I'm looking for a htaccess rewrite rule which will allow me to serve the /sitemap URL through the standard index.php routing mechanism in Magento but allow sitemap/*.xml to be served as a file.
This is my attempt, which I was hoping would check if the URI contains /sitemap AND isn't a file, then rewrite the current request to the full URL of the HTML sitemap module, but it doesn't appear to have any effect.
RewriteCond %{REQUEST_URI} ^sitemap
RewriteCond %{REQUEST_URI} !-f
RewriteRule %{REQUEST_URI} sitemap/index/index #The full URL of the HTML sitemap page.
Answer
Solution:
Change :
to