.htaccess 站点地图XML和站点地图PHP

.htaccess 站点地图XML和站点地图PHP,.htaccess,mod-rewrite,sitemap,.htaccess,Mod Rewrite,Sitemap,我的Web服务器上有两个不同的站点地图文件 sitemap.xml sitemap.php 如果我调用uri/sitemap它会打开sitemap.xml,但我希望它显示文件sitemap.php中的内容 我在我的日记里写了以下几行 RewriteEngine on RewriteRule sitemap\.xml sitemap.xml RewriteRule sitemap sitemap.php [NC,L] RewriteCond %{REQUEST_FILENAME} !-f

我的Web服务器上有两个不同的站点地图文件

  • sitemap.xml
  • sitemap.php
如果我调用uri/sitemap它会打开sitemap.xml,但我希望它显示文件sitemap.php中的内容

我在我的日记里写了以下几行

RewriteEngine on
RewriteRule sitemap\.xml sitemap.xml 
RewriteRule sitemap sitemap.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f

RewriteRule ^(.*)$ $1.php
但是我没有成功,有人能帮我吗?

试试这个:

RewriteRule sitemap$ sitemap.php
RewriteRule sitemap/$ sitemap.php