Redirect 404 errors without rewriting the URL

Posted by Knocks X on Server Fault See other posts from Server Fault or by Knocks X
Published on 2012-09-02T03:29:48Z Indexed on 2012/09/02 3:39 UTC
Read the original article Hit count: 470

Filed under:
|
|
|
|

Is it possible to have an erroneous URL remain in the address bar while redirecting the user to a URL within my domain? I want www.domain.com/forum to be the actual site being served in all 404 circumstances but I don't want the referring URL to be rewritten (other than the domain portion, which is being done on the registrar level).

This is my current .htaccess

RewriteEngine On

RedirectMatch permanent ^/$ http://www.domain.com/forum/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* http://www.domain.com/forum/ [L,R]

© Server Fault or respective owner

Related posts about .htaccess

Related posts about redirect