0

.htaccess我的 Web 文档树的根目录 (htdocs/johndoe) 中有以下文件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

它只是加载 myindex.php而不是调用sitemap.php. 我哪里错了?谢谢。

4

1 回答 1

0

移动规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule sitemap.xml sitemap.php

在指令似乎解决了我的问题.htaccess之后到文件顶部。RewriteEngine on

于 2015-09-12T18:31:37.937 回答