To allow crawlers access to only the index.php file using the robots.txt file, you can add the following lines:
1 2 3
User-agent: * Disallow: / # disallow all URLs by default Allow: /index.php # allow access to the index.php file
Make sure to place this robots.txt file in the root directory of your website. However, keep in mind that the
Allow directive is not supported by all search engine bots, so some crawlers may still attempt to access other files even if you have specified only the index.php file to be allowed.