ErrorDocument 404 /errors/404.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /nieuws2.php [L]
http://yourdomain.com/news/1/0/title-of-page.html
http://yourdomain.com/ThisPageDoesntExist
<?php
require_once 'news/db.php';
require_once 'news/config.php';
// these need to be included
$exists_id = $_SESSION['url']['2'];
$news_exists = DataAccess::fetch("SELECT id FROM $newstable WHERE id = ?", $exists_id);
if(count($news_exists) > 0){
// the news post exists so put your normal news include code here
include 'news/index.php';
}else{
// the news post doesn't exist so include your 404 page
include '404.php';
}
?>