Once you have installed magento 2 project and you’d like to remove index.php from your address. Maybe from
http://example.com/, you can easely turn On the configuration under
stores > configuration > general > web > Search Engine Optimization > Use Web Server Rewrites.
Clean your cache! And voila you have your index.php disappeared from URL.