As @Meetanshi said, make sure you have
mod_rewrite enabled on the server or not.
mod_rewrite should be enabled to allow URLs without index.php.
To check whether it is enabled or not, do one of the following:
Method 1: Create a file (say: info.php) in the document root and paste below code:
Now hit the URL yourwebsiteurl/info.php and check for
mod_rewrite under Loaded Modules section. If it does not exist, it means that server does not have mod_rewrite (URL rewrites) enabled.
Method 2: Write anything wrong in the .htaccess file under document root and reload the website.
If mod_rewrite is enabled, then you should get Internal Server Error. If it does not happen, you must enable mod_rewrite on the server.
To know how to enable mod_rewrite, you can check instructions here.
Please let me know if it helped.