Please read the question carefully before marking as duplicate.
We all know, that using in .htaccess:
.htaccess
RewriteCond %{REQUEST_FIL
For Nginx, here is the rules :
location / { rewrite ^/(.*?)index\.php[^/] /$1? redirect; rewrite ^/(.*?)index\.php(?:/(.*))?$ /$1$2? redirect; }