You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: Set Up robots.txt for Production and Staging Environments
Overview
We need to set up robots.txt files for both our production and staging websites. This will help search engines index the production site correctly and prevent them from indexing the staging site.
Tasks
Create robots.txt for Production
File Location: Inside the public folder of the project.
Title: Set Up
robots.txtfor Production and Staging EnvironmentsOverview
We need to set up
robots.txtfiles for both our production and staging websites. This will help search engines index the production site correctly and prevent them from indexing the staging site.Tasks
Create
robots.txtfor Productionpublicfolder of the project.Create
robots.txtfor Stagingsrc/pages/api/robots.ts.Add Custom Route Handling
next.config.mjs.robots.txtfile is served based on the environment (production or staging).Set Environment Variable
NEXT_PUBLIC_ENV=stagingin the.envfile.robots.txtis used.Deploy and Test
https://www.devops-dynamics.com/robots.txtandhttps://devops-dynamics.com/robots.txtwork correctly.https://staging.devops-dynamics.com/robots.txtblocks all crawlers.Acceptance Criteria
robots.txtallows search engines to index the site, except for specific directories.robots.txtblocks all search engines from indexing the site.References