I have the following .htaccess file which removes file extensions and also makes url variables in my blog clean:

Code:
AddType text/x-component .htc
RewriteEngine On
RewriteBase /

# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]

# remove index
RewriteRule (.*)/index$ $1/ [R=301]

# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]

# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php 


# remove url variable from blog
RewriteCond %{REQUEST_FILENAME} !blog/index.php [NC]
RewriteRule ^blog/(.*)$ blog/index.php?art=$1 [L,QSA]
This works perfectly to remove the file extensions and also to clean up the url. The problem I have is that since I've add the last 3 lines in to clean up the url, it has now broken my code to display blog snippets.

My php class to get the blog details are:

PHP Code:
public function get_blog_entries($page){
    if(isset(
$page)){
        
$pageTimes = ($page-1)*10;
    } else {
        
$pageTimes 0;
    }
    
$query $this->pdo->prepare("SELECT * FROM blog_posts ORDER BY date_created DESC LIMIT 10 OFFSET ?;");
    
$query->bindValue(1,$pageTimesPDO::PARAM_INT);
    if(
$query->execute()){
        
$posts $query->fetchAll(PDO::FETCH_ASSOC);
    } else {
        echo 
print_r($query->errorInfo());
    }

    return 
$posts;

And I call it using:

PHP Code:
if(!isset($_GET['art'])){   
    
/***
*
* Lists all blog entries with a snippet.
*
***/
$entries $blog->get_blog_entries($_GET['page']);
$blog->pagination($_GET['page']);
//entries is array with blog details
foreach($entries as $e){
        echo 
'
    <div class="blog-snip">
            <h2><a href="'
.$e['slug'].'">'.ucwords($e['title']).'</a><br/><small>Written by '.ucfirst($e['author']).' on '.date('jS M Y',strtotime($e['date_created'])).'</small></h2>
                <p>'
.substr($e['article'],0,300).'<a href="index.php?art='.$e['slug'].'/"> ........</a></p>
        <p class="small tags"><span>Tags: </span><a href="#">'
.$e['tags'].'</a></p>
    </div>'
;
}
} else {
/***
*
* Displays chosen blog entry in full
*
***/
$entry $blog->get_blog($_GET['art']);
echo
'
    <div class="blog-entry">
        <h2>'
.ucwords($entry['title']).'<br/><small>Written by '.ucfirst($entry['author']).' on '.date('jS M Y',strtotime($entry['date_created'])).'</small></h2>
            <p>'
.$entry['article'].'</p>
        <p class="small tags"><span>Tags: </span><a href="#">'
.$entry['tags'].'</a></p>
        <p><a href="/blog/"><- Go Back</a></p>
    </div>'
;

If I go direct to a blog article, it works fine, however if I can to my index page to see the snippets, it doesn't display anything. My directory is organised /root/blog/index.php and the .htaccess file is in my root.

If I remove the last lines of my .htaccess file, the index.php page comes back to life.