GAE如何处理正则表达式URL处理程序?(How does GAE deal with regex URL handlers?)

编程入门 行业动态 更新时间:2024-10-26 04:32:08
GAE如何处理正则表达式URL处理程序?(How does GAE deal with regex URL handlers?)

如果我有类似的东西:

webapp2.WSGIApplication([ (r'/foo/?', FooHandler), (r'/bar/(\d+)', BarPermHandler) ], debug=True)

然后结果是/foo和/foo/都由我的FooHandler类和/bar/x ,其中x是BarPermHandler的数字字符串。

我的第一个问题是,这可能会创建两个相同的页面/foo , /foo/而不是让其中一个重定向到另一个,Google的搜索结果肯定会不喜欢。

然而,在考虑/bar/x路径之后我开始怀疑自己 - 我不认为GAE不会为每个可能的整数创建一个页面,直到最大URL长度为止!


所以我的问题是,这些是如何处理的? 哪一个“存在”? 在搜索结果中,用户是否链接到/foo或/foo/或两者?

If I have something like:

webapp2.WSGIApplication([ (r'/foo/?', FooHandler), (r'/bar/(\d+)', BarPermHandler) ], debug=True)

Then the result is that both /foo and /foo/ are handled by my FooHandler class, and /bar/x where x is a string of digits by BarPermHandler.

My first concern was that this might create two identical pages /foo, /foo/ rather than having one of them redirect to the other, which Google's search results would surely dislike.

However I started to doubt myself after considering the /bar/x path - I don't think it's much of a stretch to assume that GAE doesn't create a page for every possible integer up to whatever the maximum URL length is!


So my question is, how are these handled? Which one 'exists'? In search results, are users linked to /foo or /foo/ or potentially both?

最满意答案

我真的不知道“创建页面”是什么意思。 GAE根本不创建任何页面,它们都是动态处理的。

正如您所理解的那样,第一个URL的问题不仅仅是有两个类似的URL,而且两个URL都指向完全相同的内容。 相比之下,据推测,BarPermHandler将根据传递的整数显示不同的内容,因此在这种情况下SEO没有问题。

I don't really know what you mean by "creating a page". GAE doesn't create any pages at all, they are all handled dynamically.

The issue for the first URL, as you seem to have understood, is not just that there are two similar URLs, but that both URLs point to exactly the same content. By contrast, presumably BarPermHandler will show different content depending on which integer is passed, so there is no problem with SEO in that case.

更多推荐

本文发布于:2023-04-29 11:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何处理   程序   正则表达式   GAE   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!