Steps to Remove Index.php from a URL in Magento 2:
- Log in to Admin panel
- Navigate to Stores > Configuration > General > Web
- Expand the Search Engine Optimization section
- Set “yes” to Use Web Server Rewrites option.
- Further, expand the Base URLs (Secure) section
- Set “yes” to Use Secure URLs on Storefront

