Mod_rewrite将index.php添加到url的末尾

I want to apologize for not being a strong knowledge of the language, but I have a problem like that. I made a redirect through mode_rewrite now url is "localhost/url/url2/" apache and it redirects to "localhost/url/url2/index.php" how to remove from url "index.php?"

if you want to remove only index.php then put code like this in htaccess,

RewriteRule ^/$ http://localhost/url/url2/index.php

place this htaccess file where index.php is

You can use this rule:

RewriteRule ^url/url2/$ /url/url2/index.php [L]

Browser won't show index.php in the URL input.