使用.htaccess从url中删除尾随/index.php

I am building one angular app with PHP as the API server. I would like to clear the trailing /index.php from the angular post method. I tried using .htaccess file like below

    ######### Begin - RewriteEngine enabled
    RewriteEngine On
    ########## End - RewriteEngine enabled

    ########## remove index.php from the end of URI
    RewriteCond %{THE_REQUEST} /index\.php [NC]
    RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
    ########## 

My url structure is like below

http://localhost/api/auth/index.php

And I would like to access it like http://localhost/api/auth

Right now I am able to get the post data by using

this.http.post('/api/auth/', parameters, request.options)

But I don't want that / at the end of the url. How can I add this condition too in the .htaccess file? Any help could appreciated.

Add RewriteRule that appends trailing slash.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ /$1/ [L,R=301]