Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable the ${appName}.elasticbeanstalk.com URL?

Here's my scenario:

  1. I have an Amazon EB application
  2. I use a third party DNS/cache/attack-protection service (Cloudflare) instead of Route 53

Problem: Search engines are (also) crawling and indexing my ${appName}.elasticbeanstalk.com URL

Q: How do I disable the ${appName}.elasticbeanstalk.com URL for good to only use my chosen (.com) name?

like image 235
othon2000 Avatar asked Oct 20 '22 11:10

othon2000


1 Answers

I will answer with the best thing I've found so far, just to make sure I can help other people.

Assuming there is no way to completely disable the elasticbeanstalk URL, best thing I found was to add an entry to .htaccess file redirecting.

# Redirect elastic beanstalk addresses to www.example.com
RewriteCond %{HTTP_HOST} elasticbeanstalk\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

You can do something better to consider your testing environments as well.

like image 127
othon2000 Avatar answered Oct 31 '22 19:10

othon2000