站点地图是根据以下原则在站点上生成的:/public/{название хоста}/sitemap.xml
. 它没有放在 rootpublic
中,因为管理面板可以选择允许您设置多站点,并且每个主机都需要自己的站点地图。
问题如下.htaccess
:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
结果如下。例如,生成的站点地图site-1
可在两个 URL 获得:
我发现这种行为是由于RewriteRule ^(.*)$ index.php [QSA,L]
(如果您注释掉这条规则 2. 停止工作)。但由于不难猜测 - 它不能被删除:)
因此,是否可以调整.htaccess
规则:RewriteRule ^(.*)$ index.php [QSA,L]
不考虑扩展*.xml
这种设置没有太多经验(更准确地说,几乎没有:)),所以我决定寻求帮助。
在查看了类似的主题后,我找到了一个解决方案,
.htaccess
添加以下条件: