we have a new site in a new directory in public_html as shown in below with yellow.
We need to add rules to new_site/.htaccess to fulfill the following three rules:
- Removing
.phpfrom the end of URLs - Force trailing slash
/at the end of most urls (excluding .jpg, .png, ...) - Removing
/index.php?from the middle of various URLs.

Most probably, this would be what I tried to ask:
Currently,
domain.com/ns/abc.php
domain.com/ns/abc_abc.php
domain.com/ns/index.php?/abc
domain.com/ns/abc/index.php?/abc
domain.com/ns/abc/abc/index.php?/abc/123
domain.com/ns/abc/abc/index.php?/abc/abc/123/123
To
domain.com/ns/abc/
domain.com/ns/abc_abc/
domain.com/ns/abc/
domain.com/ns/abc/abc/
domain.com/ns/abc/abc/abc/123/
domain.com/ns/abc/abc/abc/abc/123/123/
We have also tried some previously posted rules to do this task. Such as
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /ns
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
The above code helped us and removed index.php. However, we could not figure it out how to remove /index.php?.
Any comment/advice is appreciated! Thanks!