【发布时间】:2020-03-21 13:27:47
【问题描述】:
我正在使用 Google App Engine (go).. 我希望重定向 https://www.ibikeride.com/scotland/comrie-croft-mountain-bike-trails/amp
致https://www.ibikeride.com/scotland/comrie-croft-mountain-bike-trails
我查看了有关重定向的谷歌应用引擎文档,但内容非常模糊。我假设它是在处理程序下的 app.yaml 文件中设置的重定向。
我实际上想将所有以“amp”结尾的文件重定向到没有 amp 的相同 url 结构 如果有一种直接的方法可以避免我进行 100 多个单独的重定向。
这里的相关信息是我当前的处理程序看起来 NB(在尝试此之前)。我有一些处理程序可以从 url 的末尾删除“.html”(针对特定类别),最后还有一个处理程序可以将所有文件重定向到安全的“https”
任何帮助表示赞赏
handlers:
# this serves your static/some/path/<file>.html asset as /some/path/<file>.html
- url: /(england/.*\.html)$
static_files: static/\1
upload: static/england/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>
- url: /(england/.*)$
static_files: static/\1.html
upload: static/england/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>.html
- url: /(scotland/.*\.html)$
static_files: static/\1
upload: static/scotland/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>
- url: /(scotland/.*)$
static_files: static/\1.html
upload: static/scotland/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>.html
- url: /(wales/.*\.html)$
static_files: static/\1
upload: static/wales/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>
- url: /(wales.*)$
static_files: static/\1.html
upload: static/wales/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>.html
- url: /(northern-ireland/.*\.html)$
static_files: static/\1
upload: static/orthern-ireland/.*\.html$
# this serves your static/some/path/<file>.html asset as /some/path/<file>
- url: /(northern-ireland.*)$
static_files: static/\1.html
upload: static/northern-ireland/.*\.html$
#redirect always to https
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
【问题讨论】:
标签: google-app-engine redirect http-status-code-301