0
由於我們在頁面中使用了ajax,因此我們需要爲來自Ajax Prerender服務的搜索bots請求提供服務。如何創建僅傳遞請求路徑的規則 - urlrewritefilter
爲此,我創建了一條規則來修改抓取請求。 <OUR_DOMAIN>/stocks?_escaped_fragment_=
轉換爲http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stocks
我使用以下規則:
<rule>
<name>escaped_fragment</name>
<!--<condition type="request-filename" operator="notfile"/>-->
<condition type="query-string" operator="equal">.*escaped_fragment.*</condition>
<from>(.*)$</from>
<to type="proxy" last="true" qsappend="true">http://www.MY_SEO_SERVER.com/TOKEN_e291b9f78$1</to>
</rule>
的問題是,它產生一個錯誤的URL:http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
。
很想獲得關於如何正確構建規則的建議。
我使用urlrewritefilter - 4.0.3
登錄:
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.u.ServerNameMatcher | looking for hostname match on current server name localhost
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.UrlRewriteFilter | checking for status path on /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.UrlRewriter| processing request for /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | escaped_fragment (rule 0) run called with /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | matched "from"
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.Condition | evaluating "_escaped_fragment_=" against .*escaped_fragment.*
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | conditions match
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | found 1
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | replaced sb is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | found 1
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | replaced sb is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.RuleExecutionOutput | needs to be
proxied from http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.UrlRewriter| rule is last
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | execute,
target is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | response commit state: false
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | checking url
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | seting up the host configuration
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | config is HostConfiguration[host=http://www.MY_SEO_SERVER.com]
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | setting proxy request parameter:connection, value: keep-alive