RewriteEngine On RewriteMap map txt:/path/to/file/map.txt RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteRule (.+) ${map:$1|/path/to/404.html} Map file contains: /uri1/foo.html http://other.server/foo.html ...