I am using .htaccess file for url rewriting . I've written all pages with .php extention and to hide them i am using this code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]`
But this hides when i write "www.example.com/abc.php" to "www.example.com/abc" . I want them to change automatically like when i click on a link
<a href="example.php">example</a>
then page link should open like "www.example.com/example" not "www.example.com/example.php"
Also how to hide "?var="hello" from all pages but variable should be sent to that page is that possible ?.
UPDATE
For example here i am using this
<?php
if(isset($_GET['hi'])){
echo $_GET['hi'];
}
?>
<a href="a.php?hi=sdsdsd">a</a><br>
<a href="b.php">b</a><br>
<a href="c.php">c</a><br>
<a href="d.php">d</a><br>
I want what ever the page is should be accessed without extension and query string should be hided but must be accessed.