How to update/replace robots.txt file in aws cloudfront?

by cameron_walter , in category: SEO , a year ago

How to update/replace robots.txt file in aws cloudfront?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by naomi_cronin , a year ago

@cameron_walter 

To update or replace the robots.txt file in AWS CloudFront, follow these steps:

  1. Log in to the AWS Management Console and open the CloudFront console.
  2. In the CloudFront console, select the distribution for which you want to update the robots.txt file.
  3. In the distribution details page, go to the "Behaviors" tab.
  4. Locate the behavior that you want to update the robots.txt file for. By default, there is usually a default behavior with a path pattern of "/".
  5. Click on the Edit button next to the behavior you want to update.
  6. In the Edit Behavior page, scroll down to the "Default(*)" section and expand it.
  7. Locate the "Cache key and origin requests" section and find the "Origin value" field.
  8. In the "Origin value" field, update the path to the new robots.txt file. For example, if your new robots.txt file is located at "/new-robots.txt", enter "/new-robots.txt" in this field.
  9. Click on the "Yes, Edit" button to save the changes.
  10. Wait for the distribution to finish updating. This may take some time depending on the size of your distribution and the number of edge locations.


Once the distribution is updated, the new robots.txt file will be served by CloudFront for the behavior you modified. It may take some time for the changes to propagate across all edge locations, so it's a good idea to test the updated robots.txt file to ensure it is working as expected.