Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache:无法将sitemap.xml重写为sitemap.php_Php_Apache_.htaccess_Sitemap_Web.sitemap - Fatal编程技术网

Apache:无法将sitemap.xml重写为sitemap.php

Apache:无法将sitemap.xml重写为sitemap.php,php,apache,.htaccess,sitemap,web.sitemap,Php,Apache,.htaccess,Sitemap,Web.sitemap,我的web文档树的根htdocs/johndoe中有以下.htaccess文件,其中可以找到index.php: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2&menu2=$3 [QSA,NC,L] Rewrite

我的web文档树的根htdocs/johndoe中有以下.htaccess文件,其中可以找到index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2&menu2=$3 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?lang=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule sitemap.xml sitemap.php
不确定我做错了什么,但当我访问:

http://localhost/johndoe/sitemap.xml
它只是加载my index.php,而不是调用sitemap.php。我哪里做错了?谢谢。

移动规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule sitemap.xml sitemap.php
就在RewriteEngine on指令之后,在.htaccess文件的顶部,似乎解决了我的问题