As answered by Brian above:
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.*)$ /index.php [R=301]
As suggested by Chris above:
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.*)$ /index.php [R=307]
If you are trying to do an internal redirect, where the url is NOT rewritten in the browser:
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.*)$ /index.php
Brian's method will do a 301 redirect. This will tell any search engine/browser/cache that the content has moved permanently, the existing url is gone and shouldn't be used. Chris's method will do a 307 redirect. 307 is the HTTP/1.1 equivalent of a temporary redirect. Both will rewrite the URL in the browser, both will have the effect of the person going to the site, clicking that url and being redirected to the new url of foo.com/index.php. The last method will do that rewrite of the url internally so that the url in the browser remains foo.com/contact rather than foo.com/index.php
None of the rules actually pass any parameters to index.php, so, the 301 & 307 redirects would actually lose the remainder of the url. If you are using the 301/307 redirects to redirect everything to a doorway page, this behavior might be acceptable. If that is your intention, I would suggest using:
ErrorDocument 404 /index.php
and then make sure all images/links are relatively/absolutely linked in that page or you use a to make sure urls are properly rewritten on the resulting page.
If you want to pass the requested URI to index.php as a parameter for parsing:
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.*)$ /index.php?page=$1
In this case, $_REQUEST['page'] would contain /contact from foo.com/contact