我使用的同时托管多个网站的CMS和我正在寻求一种方法来正确地服务于sitemap.xml的文件为每个站点。我的结论是一个mod-rewrite规则将是这样做的最有效的解决方案。
我的想法是有一个/网站地图/目录下的网站地图命名为域名的各个领域,即/sitemaps/acmewidgets.com.xml
由于相应的Sitemap网址是acmewidgets.com/sitemap.xml我需要建立一个mod-rewrite规则,将映射此相应的帮助。
感谢您!
解决方案 重写规则/?sitemap.xml%{DOCUMENT_ROOT} /站点地图/%{HTTP_HOST}的.xml [L]
I am using a CMS that hosts multiple websites simultaneously and I am seeking a method to properly serve sitemap.xml files for each site. I have concluded that a mod-rewrite rule will be the most effective solution for this.
My idea is to have a /sitemaps/ directory with the site map for each domain named as the domain name, i.e. /sitemaps/acmewidgets.com.xml
Since the appropriate sitemap url would be acmewidgets.com/sitemap.xml I need assistance with creating a mod-rewrite rule that will map this accordingly.
Thank you!
解决方案RewriteRule /?sitemap.xml %{DOCUMENT_ROOT}/sitemaps/%{HTTP_HOST}.xml [L]