There are several different solutions. The best of them, both in terms of SEO and from the point of view of users, is an individual 301 redirect. It saves your link juice and at the same time redirects the client to the exact location on the new website.
If you have mod_alias enabled, I would suggest a simple
RedirectMatch 301 ^(.*)$ / http://new.domain.com/$1
The result command can be executed using
RewriteEngine On RewriteRule (.*) http://new.domain.com/$1 [R=301,L]
The second option is the best choice if you need to link several conditions and filters. For example, if you need to redirect only certain hosts or clients depending on the User Agent header.
Remember: mod_redirect takes precedence over mod_alias.
Simone carletti
source share