0

I've tried to redirect the root URL of my S3-hosted website (built in Jekyll, deployed using the s3_website gem), but haven't had any success.

My goal in the following example is to redirect http://www.example.com/ to http://www.example.com/redirect_to_here/ using s3_website's routing features.

Here are two routing rule variations I've tried without any luck:

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

and

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

Is this possible given S3's redirect implementation? If so, what am I missing?

Mike Jarema
  • 1,187
  • 1
  • 11
  • 16

1 Answers1

0

Rather than resorting to the routing_rules and remembering that S3 treats index.html as the root path, the following ended up working. Specifically I used redirects rather than routing_rules to achieve this:

# s3_website.yml
redirects:
  index.html: /redirect_to_here/
Mike Jarema
  • 1,187
  • 1
  • 11
  • 16
  • Quick note -- `index.html` is the _default_ index document. So if you've changed it for your deployment (eg. to `foo.bar`), simply update the redirect to reflect this. – Mike Jarema Nov 27 '14 at 21:09