I have the following .htaccess at present.
suPHP_ConfigPath /home/abc/php.ini
RewriteEngine on
RewriteCond $
Possibly because you have QSA added on there - it means Query String Append.
RewriteCond %{REQUEST_URI} ^(.*/)([^/]+)$
RewriteRule . %1 [R=301,L]
I wasn't sure from your description exactly what you were after, so you should keep or remove the second RewriteCond depending on your specific needs.
RewriteEngine On
# Remove the query string with a redirect
RewriteCond %{QUERY_SRING} !=""
# But only if the path ended with a /
# (remove this to redirect anything with a query string)
RewriteCond %{REQUEST_URI} /$
RewriteRule .* /$0? [R=301,L]
# Then perform your internal rewrite
RewriteCond $1 !^(index\.php|media|css|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
The following should work:
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^ /index.php/? [L]
From the Apache documentation:
When you want to erase an existing query string, end the substitution string with just a question mark
EDIT (again): As external redirect (you may not even need the second RewriteCond if you don't have any query string at all in your application):
This will tell the client to request the same URI without query string.
RewriteEngine on
# redirect to same URI, but without query string
RewriteCond %{QUERY_STRING} .
RewriteRule ^ %{REQUEST_URI}? [R=301]
# CodeIgniter "magic"
RewriteCond $1 !^(index\.php|media|css|js|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]