When server rewrites are turned off in the Magento installation and a reindex is done through the command line, indexer.php
will be added to the URLs.
The only way to prevent this is to turn on server rewrites. This can be done by navigating to System > Configuration > General > Web > Search Engine Optimalization and setting Use Web Server Rewrites to Yes.