7

I have a website set up using S3 as a static website host. If I have a link such as "xxx.com/play?test=1", this gets a 302 redirect to "xxx.com/play/" with the query parameter stripped.

I am trying to find a way so that the query string parameters gets preserved. I cannot change the original link (xxx.com/play?test=1) - but it feels that within either the redirect rules, or within the objects themselves I can make this work. Is this possible?

dojogeorge
  • 1,674
  • 3
  • 25
  • 35
  • Yes, either of those should work. How many URLs are we talking about? – Michael - sqlbot May 05 '17 at 00:09
  • This is for about 5 URLs currently – dojogeorge May 05 '17 at 09:59
  • I know you can do it with [routing rules](http://stackoverflow.com/a/24001725/1695906), though it's a little bit messy and imprecise. I haven't tested (or don't recall testing) whether using [`x-amz-website-redirect-location`](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html) with an empty dummy object removes the query string. – Michael - sqlbot May 05 '17 at 11:22

1 Answers1

0

Don't know if you found a solution by now... but here it is for future reference.

I'm guessing you have a "play" folder in your bucket and that's why it's redirected.

The solution it to create a "play" object/file (alongside the folder) without the ".html" extension and change the metadata to "text/html".

natanavra
  • 2,100
  • 3
  • 18
  • 24