mod_rewrite cookbook

Redirect to another host for nonexistent content (e.g. configure this on example.com, and it will redirect to transcendlinux.com if a requested file or directory doesn't exist)

RewriteCond %{HTTP_HOST}   !^transcendlinux\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d
RewriteRule ^/(.*)         http://transcendlinux.com/$1 [L,R]

Submitted by jkelly on Fri, 2006-09-08 02:32. categories [ | ] login or register to post comments