I've created a rewrite map that's working well:
.htaccess
RewriteRule ^([^/\.]+)/?$ index.php?page=${mymap:$1} [L]
mymap.txt
home 1
about 2
contact 3
So www.myurl/home works fine, but www.myurl/nonexistant_page doesn't exist in mymap.txt so I get an SQL error. Is there a way to check if the map exist and if not got to 404 page?