0
votes

I am using htaccess coppied from wordpress.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

It works fine.

I would like to add a script to redirect to sitemap.php file if user requests sitemap.xml.

I tried adding RewriteCond %{REQUEST_FILENAME} !-^sitemap.xml$ but didn't work.

1

1 Answers

3
votes

Put the rule BEFORE that set of rules:

RewriteRule sitemap\.xml sitemap.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]