To remove index.php from your WordPress URL you will need to do two things.
The first step is updating the Permalinks within the WordPress Dashboard.
Login to your WordPress Dashboard and Click Settings > Permalinks. Under Common Settings, Select Custom Structure and in the text field enter /%postname%/
Click Save Changes
The second step is creating an .htaccess file which is then uploaded into the root location of the WordPress site.
Make sure your .htaccess file will contain the below rules:
#htaccessrule for wordpress default
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin/
RewriteRule ^(.*)$ index.php/$1 [NC,L]