Redirect incoming traffic to homepage
You could do this easier in your .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_URI} !/$
RewriteRule $ / [R=302,L]


Put this at the bottom of your .htaccess file and you're set.