Magento by default uses index.php for routing to urls. It is because some time you are on shared hosting and your apache is not configured with url rewrites = on or even on dedicated server you don’t have configured apache to work with url rewrites.
To remove “index.php” from magento urls you need to turn on the url rewrites.
It is simple in dedicated hosting
Edit httpd.conf (apache configuration file) and un-comment following line by removing “;” or “#” from beginning of line.
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
Save the file and restart apache.
In shared hosting that is normally on, but if that is off then you need to contact your hosting provider to turn it on.
After making sure url rewrites are on, go to Magento backend >configuration >General >web
Look for “Search Engines Optimization” section
Look for “Use Web Server Rewrites” and select “Yes” from dropdown, Save the config and refresh the front page of your website, you will see index.php is removed from urls.