I am using a template on my website. This template is designed in a way where everything is in the index.php file but the functions are executed based on the query string which is stick to the index.php file.
I want to permanently redirect to the root mysite.com when my site is accessed with index.php with no query string parameters, but if there is any query string parameter then it should not be redirected and should remain the same.
To achieve this, this is what I added in my .htaccess file, but it affects the query string and the site is unable to be navigated properly.
...
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
...
Thanks for the help.