Redirect all Old Links to a New Domain

At some point in your online life, you’re going to need to change the domain for a website. Maybe your business name changed or you’ve decided to rebrand your lifestyle blog or the myriad of other reasons why this might happen. Now you’ve got to redirect all old links to a new domain.


You want to keep the website as it is, you want all your old links to remain intact and working, but you want the new domain to be prioritized from an SEO perspective, and you want users/readers to quickly get acclimated to the new domain name and start using it.

Your 5 Minute Redirect Fix

  1. Make sure the old domain is pointed to the same hosting server that your website lives on. This should already be the case, of course. But I’m mentioning it because sometimes when a domain name is changed, people often take that as an opportunity to switch hosting providers.
  2. Open up the .htaccess file for your website and add this:
    # Redirect the site
    RewriteEngine On
    # Take care of
    RewriteCond %{HTTP_HOST} ^$ [NC]
    RewriteRule ^(.*)$$1 [L,R=301]
    # Takes care of
    RewriteCond %{HTTP_HOST} ^oldwebsite.comm$ [NC]
    RewriteRule ^(.*)$$1 [L,R=301]

    What’s this code doing? If someone types in, it will redirect them to If someone types in, it will redirect them to So it takes care of both the www situation and the standalone URL situation.

This is a much better solution than just forwarding your old domain to your new one. Why? Because it keeps all your old links intact. If someone ever linked to you in the past, those links will still work (provided you’ve kept the same link structure as it was in the past). This is great for accessibility and also for SEO. Over time, Google will pick up on the fact that the new domain is your primary domain and shift your SEO juice to the new one from the old. Win and win.