0

I have a static website hosted in AWS S3 with a URL www.example.com. However, I need www.example.com/blog to point to an EC2 instance instead of looking for blog inside S3, since I installed Wordpress in that instance to serve the blog content. I am aware it is possible to do this by tweaking the Apache config file, as stated here, but this doesn't seem valid for S3 static hosting.

So, is this possible?

EDIT

My question was flagged as possible duplicate of this question. However, The solution proposed there would alter the URL www.example.com/blog, which I want to preserve.

  • 3
    http://serverfault.com/questions/650704/url-rewriting-in-amazon-s3 – ceejayoz Oct 06 '16 at 20:20
  • 3
    Or, put CloudFront in front of it and use multiple origins (if you want to preserve the `example.com/blog` URL instead of a redirect). – ceejayoz Oct 06 '16 at 20:21
  • It already has CloudFront distributing it, but I can't seem to make this work with multiple origins. I'll play with it a bit more. – lucasnadalutti Oct 06 '16 at 20:44
  • 3
    Agree with ceejayoz this should be straightforward to setup with multiple origins in cloudfront. The pain here is to make sure the blog generates links that make sense in this context and doesn't try to redirect clients around cloudfront. – Nath Oct 06 '16 at 22:32

1 Answers1

0

Set up a redirect with S3. This can be a 301 redirect to a blog subdomain, which isn't exactly what you asked, but it's easier.

If you really want to have S3 host the website, with a blog in a subdirectory, I think you'll need to set up the domain to point at the EC2 server with appropriate redirects for non-blog directories.

Tim
  • 31,888
  • 7
  • 52
  • 78