php:将 sitemap.xml 移动到文件夹中
php: move the sitemap.xml into folder
有一个网站具有 .htaccess
文件存档的多语言功能。
我已经生成了 sitemap.xml
文件,我可以使用 sitename.com/sitemap.xml
访问它
对 php 有一点经验,我会问我如何 'move' .xml 文件到一个地方,以便我可以通过 sitename.com/ro/sitemap.xml
访问它?
您可以将 sitemap.xml
保留在根文件夹中并在 DocumentRoot
.htaccess 中添加此规则:
RewriteEngine On
RewriteBase /
RewriteRule ^ro/(sitemap\.xml)$ / [L,NC]
现在您可以将此 URL 用作 http://sitename.com/ro/sitemap.xml
有一个网站具有 .htaccess
文件存档的多语言功能。
我已经生成了 sitemap.xml
文件,我可以使用 sitename.com/sitemap.xml
对 php 有一点经验,我会问我如何 'move' .xml 文件到一个地方,以便我可以通过 sitename.com/ro/sitemap.xml
访问它?
您可以将 sitemap.xml
保留在根文件夹中并在 DocumentRoot
.htaccess 中添加此规则:
RewriteEngine On
RewriteBase /
RewriteRule ^ro/(sitemap\.xml)$ / [L,NC]
现在您可以将此 URL 用作 http://sitename.com/ro/sitemap.xml