0

I follow these Steps to generate the Robots.txt file

after that, I can see the file content through the URL, Ex. https://example.com/robots.txt

But, I want to know the actual path of that file in the root directory of the Magento Project.

Thank You in Advance!

2

2 Answers 2

1

You don't need to locate the robots.txt from magento cause it's possible to update it directly from configuration.

Go to Content > Design> Configuration > Global > Search Engine Robots

And there you can do whatever you want with your robot.

1

You do not have to generate a robots.txt file in Magento directory because Magento generates the robots.txt content on demand and stores it in the database. It does not create a file, but you can view the content in your browser with the <domain.your.project>/robots.txt link.

The config for robots.txt file is stored in core_config_data database table, you can check the value for design/search_engine_robots/default_robots and design/search_engine_robots/custom_instructions paths.

SELECT * FROM `core_config_data` WHERE `path` LIKE 'design/search_engine_robots/%'

You should update the config for robots.txt from admin:

Admin sidebar > Content > Design > Configuration.
Find the Global configuration in the first row of the grid and click Edit.
Scroll down and expand the Search Engine Robots section to config rotbots.txt

Read more about config for robots.txt in the Magento official document https://experienceleague.adobe.com/docs/commerce-admin/marketing/seo/seo-overview.html#search-engine-robots

Conclusion: If you use the default Magento feature mentioned above to generate robots.txt, there is no robots.txt file in your Magento directory but the config for robots.txt is stored in the database.

If you create a robots.txt file manually, and put it in Magento directory>/pub/, it will override the default Magento robots.txt file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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