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?


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
  • 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 6 '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. Oct 6 '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 6 '16 at 22:32

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.