How to configure S3 redirects for static Vue.js app

0

I have a static Vue.js app using hash mode in an AWS S3 Bucket without Cloudflare.

I'm trying to redirect this URL (with an old, no longer used page slug):

http://www.seathefuture.org/#/tool/BCDC%20Adapting%20to%20Rising%20Tides%20Bay%20Shoreline%20Flood%20Explorer

to this page (with new, working slug):

http://www.seathefuture.org/#/tool/BCDC-Adapting-to-Rising-Tides-Bay-Shoreline-Flood-Explorer

In the AWS Console for the S3 bucket, under "Static website hosting" > "Redirection rules", I have the following XML:

<RoutingRules>
  <RoutingRule>
    <Condition>
      <KeyPrefixEquals>/#/tool/BCDC-Adapting-to-Rising-Tides-Bay-Shoreline-Flood-Explorer</KeyPrefixEquals>
    </Condition>
    <Redirect>
      <ReplaceKeyWith>/#/tool/BCDC%20Adapting%20to%20Rising%20Tides%20Bay%20Shoreline%20Flood%20Explorer</ReplaceKeyWith>
      <HostName>seathefuture.org.s3-website-us-east-1.amazonaws.com</HostName>
      <Protocol>http</Protocol>
    </Redirect>
  </RoutingRule>
</RoutingRules>

I've also tried it with just seathefuture.org set as the HostName and tried it without a HostName and Protocol at all but none of those configurations are actually forwarding the old URL to the new one. Any ideas on how to fix?

Edited by: ChrisHeu on Oct 25, 2019 10:54 AM

已提問 5 年前檢視次數 1087 次
1 個回答
0

Just following up on my own post here. I had a Vue method that was checking for specific tool names and using the Vue router to send any invalid name slug to the same designed page (/filter). So all I did was add to that method such that if a previous version of the tool name slug was being requested, it would route to the updated version. I'm still not sure if those XML routing rules are properly configured or would work if necessary but since the issue was otherwise resolved, I no longer need those S3 bucket redirection rules.

已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南