Amazon S3 Redirect rule - GET data is missing

前端 未结 2 1142
遥遥无期
遥遥无期 2020-12-09 23:38

We recently moved our website to Amazon S3 (all static pages). We moved al static files to a different subdomain which still points to our old server.

All is working

2条回答
  •  眼角桃花
    2020-12-10 00:36

    The key is to use ReplaceKeyPrefixWith instead of ReplaceKeyWith.

    With Gulp and gulp-awspublish for instance, the config is in JSON.

    So going from:

    Condition:
      KeyPrefixEquals: 'us.html'
    Redirect:
      ReplaceKeyWith: 'about.html'
    

    To

    Condition:
      KeyPrefixEquals: 'us.html'
    Redirect:
      ReplaceKeyPrefixWith: 'about.html'
    

    Will make example.com/us.html?a=1 redirect to example.com/about.htmk?a=1.

    Be careful of loops, eg.

    Condition:
      KeyPrefixEquals: 'about'
    Redirect:
      ReplaceKeyPrefixWith: 'about.html'
    

    Will make a redirect loop by adding .html.html.html etc.

提交回复
热议问题