我的主页可以通过两个不同的领域访问。
我手动为每个站点创建了位于我页面根目录中的sitemap.xml。(sitemap1.xml / sitemap2.xml)
输入URL example.at/sitemap.xml或example.de/sitemap.xml后,需要重定向到正确的.xml文件。
1: https://example.at/sitemap.xml => https://example.at/sitemap1.xml
2: https://example.de/sitemap.xml => https://example.de/sitemap2.xml
我试过折叠式重定向规则:
RewriteCond %{REQUEST_URI} ^\/sitemap\.xml$
RewriteRule .* https://example.at/sitemap1.xml [R=301,L]
RewriteCond %{REQUEST_URI} ^\/sitemap\.xml$
RewriteRule .* https://example.de/sitemap2.xml [R=301,L]无论是输入.de还是.at地址,我都会被转发到:https://example.at/sitemap1.xml。
我没有重写规则的经验,所以我使用了:https://www.webcellent.com/tools/modrewrite/
会很感激你的帮助。
提前感谢!
发布于 2019-07-11 12:07:57
RewriteCond %{HTTP_HOST} ^example.at$
RewriteCond %{REQUEST_URI} /sitemap.xml
RewriteRule ^(.*)$ https://example.at/sitemap1.xml [R=301,L]
RewriteCond %{HTTP_HOST} ^example.de$
RewriteCond %{REQUEST_URI} /sitemap.xml
RewriteRule ^(.*)$ https://example.de/sitemap2.xml [R=301,L]编辑:可能是一个缓存问题
https://stackoverflow.com/questions/56988377
复制相似问题