I'm attempting to perform this kind of rewrite

http://sitename/foo/var1/var2 -> http://sitename/foo/index.php?/var1/var2

This really is my .htaccess file(put into your directory foo):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

During my php script I'm exhibiting the values of $_SERVER['REDIRECT_QUERY_STRING'] and $_SERVER['REQUEST_URI']

Basically request a URL like http://sitename/foo/bar the values not surprisingly are bar and /foo/bar correspondingly.

This works not surprisingly for: http://sitename/foo/admin and http://localhost/foo/bar.

However, if I attempt to gain access to http://localhost/foo/admin (using localhost rather than sitename) the REQUEST_URI changes to /admin/?admin (this is the way it shows within the address bar too, i.e http://localhost/foo/admin/?admin)

I looked for just about any .htaccess files that could be conflicting as well as switched on mod_rewrite logging at level 6 but was not able to locate any info.

I have no idea what may be leading to it. It is always good basically could understand what may be leading to this, otherwise I would change to nginx.

Thanks all for replies. It was some strange server configuration error, things appear to become fine around the new VM I installed. @Serta Grossman , interesting suggestion about using $_GET, a number of my code now is easier than earlier.