When I add this htaccess file to my htdocs, it perfectly rewrites the url to remove the filenames from my addressbar. but whenver I load a webpage that has additional addressbar info like
You can definitely do what you want with .htaccess rules! The difficult part is figuring out the right rules, because .htaccess rules can be complicated. I too often have issues with figuring out the right rules.
In this case, the fix is pretty simple.
Instead of this line:
RewriteRule ^([^.]+)$ $1.php [NC,L,QSA]
You can just do this instead:
RewriteRule ^([^.]+) $1.php [NC,L,QSA]
I think the dollar sign at the end is preventing the rule from being applied when a query string is present. I think this should solve it, but I haven’t tested it, so I’m not sure.