对于sitemap.xml的mod-rewrite规则 [英] mod-rewrite rule for sitemap.xml

查看:146
本文介绍了对于sitemap.xml的mod-rewrite规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的同时托管多个网站的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]

这篇关于对于sitemap.xml的mod-rewrite规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆