The problem with this is that any request for "/" is internally rewritten to index.php by Apache mod_dir if you have index.php in the DirectoryIndex list (the usual set-up), so it's difficult to avoid an infinite loop.
It can be done with mod_rewrite in .htaccess like this:
so a flexible pattern was provided to handle all valid request cases.
THE_REQUEST is the original request from the client (browser or robot). The RewriteCond will only allow the RewriteRule to be invoked if the client actually requested index.php, and not if the current (internal) request is for index.php only as a result of mod_dir's DirectoryIndex internal URL rewrite. While the rule pattern appears to be redundant, it improves the code efficiency because RewriteConds are only processed if the RewriteRule pattern matches.
The first directive may or may not be needed. It may cause a server error if it is needed but missing, or if it not needed but present. This depends on your server, so you may have to test to find out. The first two directives won't be needed if you already have working rewriterules in your .htaccess file.