In order to use mod_rewrite you can type the following command in the terminal:
a2enmod rewrite
Restart apache2 after
/etc/init.d/apache2 restart
or
service apache2 restart
Then, if you'd like, you can use the following .htaccess file.
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
 Options +FollowSymlinks
 RewriteEngine On
</IfModule>
# Unless an explicit file or directory exists, redirect all request to index
<ifmodule mod_rewrite.c="">
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</ifmodule>
The above .htaccess file (if placed in your DocumentRoot) will redirect all traffic to an index.php file in the DocumentRoot unless the file exists.