seo页面问题与article.php中的链接

friends so i created seo friendly blog works ok but i face a issue which is say i in menu put links like index.php | contact.php all these works find but in my article.php it don't work if i do not add full url like say http://localhost/blog/index.php

hope you get what im trying to say?

here is my article.php page how i fetch records

$url = $_SERVER['REQUEST_URI'];    
$url = str_replace('/blog/', '', ucwords($url));


//$sql=mysql_query("SELECT id,title,keyword,description,image,youtube,article,created,views  FROM article WHERE url='".$url1."'");    

$stmt = $db->prepare("SELECT id,title,keyword,description,image,youtube,article,created,views  FROM article WHERE url = :url");

$stmt->bindParam(':url', $url, PDO::PARAM_STR);

$stmt->execute();    
$row = $stmt->fetch();
$count = $stmt->rowCount();

//$count = mysql_num_rows($sql);

if($count <1){    
        header("Location: ".$site_path."index.php");    
        exit();    
}

$qry = "UPDATE article SET views = views +1 WHERE url = :url";    
$stm = $db->prepare($qry);    
$stm->bindParam(':url', $url, PDO::PARAM_STR);    
$stm->execute();    

//mysql_query("UPDATE article SET views = views +1 WHERE url ='".$url."'");    
 //$row=mysql_fetch_array($sql);

and htaccess is

RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)\?*$ article.php?$1 [L,QSA]

how can i fix the issue in article.php page that like every other pages on my website even on this page i can add urls as index.php and any bla.php other than having to use http://localhost/blog/index.php

thanks alot