Question

I plan to migrate my personal blog presently using Node.js as a backend to Amazon S3, considering the fact that the content is pretty much always static.

One problem I noticed is that there's no way to do redirection or whatsoever on Amazon S3 (as far as I know).

Lets say I have this URL:

http://blogue.jpmonette.net/2013/06/11/hebergez-vos-applications-nodejs-grace-a-digitalocean

When I'll migrate it to Amazon, I'll have to create this folder hierarchy:

/2013/06/11/hebergez-vos-applications-nodejs-grace-a-digitalocean/

and then add the file index.html in it, containing the data.

Considering this, my URL will then be changed from:

http://blogue.jpmonette.net/2013/06/11/hebergez-vos-applications-nodejs-grace-a-digitalocean

to

http://blogue.jpmonette.net/2013/06/11/hebergez-vos-applications-nodejs-grace-a-digitalocean/

There's no way to redirect that right now using Amazon S3.

Also, anyone requesting http://blogue.jpmonette.net/2013/06/11/hebergez-vos-applications-nodejs-grace-a-digitalocean/index.html will obtain a file, and this is annoying in term of SEO.

Is there an available solution to prevent this behavior and preserve good SEO of my blog?

EDIT

And for people flagging it as not appropriate question, I'm looking here to make proper permanent redirection on Amazon S3, to make sure that visitors looking for articles in the future will find them. Please note here that visitor includes humans and robots.

Was it helpful?

Solution

It seems like we can create redirection rules this way (for a-propos to a-propos/):

<?xml version="1.0"?>
<RoutingRules>
  <RoutingRule>
    <Condition>
      <KeyPrefixEquals>a-propos</KeyPrefixEquals>
    </Condition>
    <Redirect>
      <ReplaceKeyWith>a-propos/</ReplaceKeyWith>
    </Redirect>
  </RoutingRule>
</RoutingRules>

Considering I have a ton of URL to redirect (83 in total), it seems impossible to do because there's a limit of redirection rule:

83 routing rules provided, the number of routing rules in a website configuration is limited to 50.


Other then that, the only option I see is to add this HTTP header x-amz-website-redirect-location to a file with the same name as your prior URL.

For the example above, create a file named a-propos and add the HTTP header x-amz-website-redirect-location and put a-propos/ as a value. This should work, but it takes forever to do.


Syntax can be found here: http://docs.aws.amazon.com/AmazonS3/latest/dev/HowDoIWebsiteConfiguration.html#configure-bucket-as-website-routing-rule-syntax

Rule generator can be found here: http://quiet-cove-8872.herokuapp.com/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top