How to redirect all traffic to the new website using .htaccess?

It’s very rare that anyone changes the main domain of the website, but it’s still possible. The main issue which you may face while shifting to a new domain is how to redirect all traffic, that is old URLs to their appropriate new URLs. For example, yourolddomain.com/some_blog_post should NOT redirect to just yournewdomain.com