How to add robots txt file in WordPress site

  • Go to Plugins from admin dashboard.
  • Search for Yoast SEO.
  • Install and Activate that plugin.

Go to SEO > Tools tab and click File editor option.

Click Create robots.txt file button.

Click Save changes to robots.txt file after adding your changes to that file.

Accessing /robots.txt file will give you the robots.txt file content in the response: