0

我试图重定向我的 S3 托管网站的根 URL(内置于 Jekyll,使用 s3_website gem 部署),但没有任何成功。

我在以下示例中的目标是使用 s3_website 的路由功能将http://www.example.com/重定向到http://www.example.com/redirect_to_here/ 。

以下是我尝试过的两种路由规则变体,但没有任何运气:

routing_rules:
  - condition:
      key_prefix_equals: "" # Empty prefix
    redirect:
      host_name: www.example.com
      replace_key_prefix_with: redirect_to_here/
      http_redirect_code: 302

routing_rules:
  - condition:
      key_prefix_equals: /
    redirect:
      host_name: www.example.com
      replace_key_prefix_with: redirect_to_here/
      http_redirect_code: 302

考虑到 S3 的重定向实现,这可能吗?如果是这样,我错过了什么?

4

1 回答 1

0

而不是诉诸routing_rules并记住 S3 将 index.html 视为根路径,以下最终工作。具体来说,我使用redirects而不是routing_rules实现这一点:

# s3_website.yml
redirects:
  index.html: /redirect_to_here/
于 2014-11-27T21:03:30.463 回答