Last Updated on April 15, 2021 by Amit

Redirect 404 URIs to a different domain with htaccess

The following rule will redirect all 404 URIs from your site to http://example.com

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .+ http://example.com/ [L,R]

You can just copy and paste this rule to your htaccess in document root folder.
This rule will only redirect 404 URIs on your site without affecting your existing files/folders.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.