简体   繁体   English

如何配置web.config,以将.aspx文件用作sitemapfile?

[英]Howto configure web.config, to use .aspx file as sitemapfile?

I am currently trying to create my own sitemapprovider. 我目前正在尝试创建自己的sitemapprovider。 A aspx (ashx?) file that will dynamically create the sitemap file on request.. no static sitemap file. 一个aspx(ashx?)文件,它将根据请求动态创建站点地图文件。没有静态站点地图文件。 Everything is read from the database. 一切都从数据库中读取。

Why? 为什么? I have multiple accounts on the same subdomain (with wildcards), and the sitemap file is different for each user. 我在同一个子域(带有通配符)上有多个帐户,并且每个用户的站点地图文件都不同。 The sitemap file is only used for google and other search engines. 该站点地图文件仅用于Google和其他搜索引擎。

user1.domain.com
user2.domain.com
user3.domain.com
...
user1000.domain.com

all these subdomain share the same files. 所有这些子域共享相同的文件。 And if I create a "/web.sitemap" then all share the same sitemap but thats not correct. 而且,如果我创建一个“ /web.sitemap”,则所有共享相同的站点地图,但是那是不正确的。 Beacause all users create their own pages on their homepage. 因为所有用户都在其主页上创建了自己的页面。 so they need different sitemaps. 因此他们需要不同的站点地图。

So. 所以。 I want my sitemap to be reachable for all search engines. 我希望所有搜索引擎都可以访问我的站点地图。 And I think that the right way is to register the sitemap in web.config. 而且我认为正确的方法是在web.config中注册站点地图。 Right? 对? Or is there another way to do it? 还是有其他方法可以做到?

the file now is: sitemap.aspx, or sitemap.ashx. 现在的文件是:sitemap.aspx或sitemap.ashx。 (I am not finished) (我还没完)

How do i register my sitemap so all search engines can find it? 如何注册我的站点地图,以便所有搜索引擎都能找到它?

Thanks! 谢谢!

I present my code to create a dynamic sitemap in the article Dynamic Sitemaps in ASP.NET . 在ASP.NET中的动态站点地图一文中介绍了用于创建动态站点地图的代码。

You can either use URL routing to refer to your dynamic sitemap as sitemap.xml, or you could simply submit the real name of your sitemap page to Google and Bing. 您可以使用URL路由将动态站点地图称为sitemap.xml,也可以仅将站点地图页面的真实名称提交给Google和Bing。

But I had a little trouble understanding exactly what you want to do. 但是我很难理解您到底想做什么。 What do you need the web.config to do exactly? 您需要web.config到底要做什么? And how would the Google crawler vary this based on user? Google搜寻器会如何根据用户进行更改?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM