gpt4 book ai didi

grails - grails Google Ajax搜索的URL映射

转载 作者:行者123 更新时间:2023-12-02 14:44:35 24 4
gpt4 key购买 nike

这可能是一个非常简单的问题,但对于我的一生,我无法使其正常运转。

我需要重定向Google对Ajax生成代码的请求,以返回用于索引的html模板

我的urlmappings.conf中包含以下内容

"/?_escaped_fragment_=$id"(controller:"google",action:"getOfferDetails")

但是,如果在浏览器中输入mysite?_escaped_fragment_ = 200,则不会调用 Controller

但是,如果我输入mysite_escaped_fragment = 200,则会调用 Controller 并执行操作。

任何建议将不胜感激。

谢谢

最佳答案

您不能使用“?”路由匹配中的char,即它将被忽略。
改用以下过滤器(将此类放在带fileName CrawlerFilters.groovy的配置文件夹中):

class CrawlerFilters {
def filters = {
google(controller: '*', action: '*') {
before = {
boolean isCrawler = webRequest.params._escaped_fragment_ != null
if (isCrawler && !request._alreadyForwarded) {
request._alreadyForwarded = true
forward controller: 'google', action: 'getOfferDetails'

}
}
}
}`

关于grails - grails Google Ajax搜索的URL映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17114458/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com