Which one is correct?
User-agent: * Disallow: index.php
User-agent: * Disallow: /index.php
inorder to block all pages like
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
You can use the following robots.txt file if you wish to block all robots from accessing your pages.
# robots.txt for www.domain.com to block all bots User-agent: * Disallow: /
If you wish to block all all URLs that include a question mark (?) you can use the following format
# robots.txt for www.domain.com to block URL with ? mark User-agent: * Disallow: /*?
For more detailed information on how to write robots.txt visit the following link How to Create Robots.txt Files
The second one is better form as it clearly marks the index.php as being the in web root and not in some other subdirectory.