RewriteEngine On

# If a file or image actually exists on the server, load it normally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# If the file does NOT exist, secretly pass it to redirect.php instead of showing a 404
RewriteRule ^(.*)$ redirect.php [L,QSA]