I am currently running Apache2 on my local machine, installed with the latest version of Ubuntu.
I am trying to get basic URL rewriting working by using the .htacces
You need to remove the contextual path prefix from your pattern when using mod_rewrite in a .htaccess file. In the case of the root directory, the path prefix is just /. So try this:
/
RewriteRule ^doesnotexist/(.*)$ /page.php?p=$1