My Location:
Poole, Dorset, UK
Availability:
View my Calendar
Email or iMessage:
hello@websiteright.co.uk

How to Seamlessly Redirect Your Domain and NOT Lose Any SEO Goodness or Customers!

How to Seamlessly Redirect Your Domain and NOT Lose Any SEO Goodness or Customers!

Sometimes, things change. Whether it’s just the logo of your company, your key marketing message, or perhaps it’s the business name entirely – either which way, there may be a circumstance whereby you need to change your website address. If this is the case, you’ll want to transition smoothly – with no damaging effect on either your Search Engine Optimisation or your customers!

It could be a re-brand, you may have just been taken over, or perhaps you have just opted for a fresh start – but regardless of the predicament, you’re highly likely to want to retain all the good work you have built up over the years in terms of making your your website sustain its ranking and to not lose any of the gravitas that you have built up with Google throughout the years!

You’ll need to spend time getting the transition right, without sacrificing any significant drop-off

To do this, you’ll need to spend time getting the transition right, and there are some great companies, including myself, who can help move websites from A to B without sacrificing any significant drop-off. The technical process of moving the website from one domain to another is a blog post in itself, but here I will just concentrate on what needs to be done once your website has migrated, the main consideration of which is to re-direct your previous website address to the new URL.

By far, the best way to accomplish this is to place an .htaccess file in the root directory of your former site. Short for Hypertext Access, .htaccess files are configuration files used by Apache-based web servers which controls the directory that it “lives” in, as well as all the subdirectories underneath that directory.

The bit of code you need to enter in the .htaccess is:

RewriteCond %{HTTP_HOST} !^myothersite\.co\.uk$ [NC]
RewriteRule ^(.*)$ https://www.newsitename.co.uk/$1?ref=oldwebsite [R=301,L]

The above code tells your website to redirect all traffic to newdestination.co.uk. Not only that, it will re-point the user to the exact page on the new site. Therefore, if anyone was to visit your News section on your old site via a bookmark or external link, they will taken to the very same page on the new site – thus avoiding confusing your visitors by taking them to the home page, where they would need to start navigating around in order to find the original page they were after!

In the above bit of code, you will also realise that I have added a line of code (Line 1) which references myothersite.co.uk. You may not encounter this scenario yourself, however, if you use cPanel and you utilise the Addon Domains feature for a second domain, you will not want that secondary domain to be redirecting to your new site, as you’ll only want traffic to the original domain to redirected.

You’ll also notice that I’ve also added a bit of code which says ref=oldwebsite – this will be appended to the URL on the new website, which means you’ll be able to add some conditional PHP on your new website, which, upon the URL variable being present, will display a notification message to the user, letting them know about the rebrand.

The following bit of code can be added to the footer.php file to your theme file in WordPress (or your relevant CMS), just below the closing body tag:

<?php if ($_GET["ref"] == "oldwebsite") { ?>

   <div id="notification" class="notification">
      <div class="notification-text">Old Site Name has rebranded to New Site Name, <a href="https://www.newsitename.co.uk/rebrand/">read more...</a>
      <span class="notification-close" style="cursor: pointer;">x</span></div>
   </div>

<?php } ?>

The above code checks for the reference in the URL (which is added by the .htaccess file on the original hosting account). If present, it will show the HTML code on the page which acts as the notification. The CSS (also provided below), decides where this text is placed on the page.

You’ll also need to add in the following jQuery to ensure user can close off the notification bar too:

jQuery(".notification-close").click(function(){
   jQuery(".notification").hide();
});

Similarly, by adding the following CSS, as well as positioning the notification, you can make things look pretty too – changing the background colour of the bar, the font, the link colour, and much more besides…

.notification {
  width: 100%;
  background: #BA0D30;
  text-align: center;
  z-index: 200000;
  display: block;
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
}

.notification a {
  color: #131A4D;
}

.notification .notification-text {
  color: #ffffff;
  font-size: 1.1em;
  font-weight: 400;
  padding: 10px 25px;
}

.notification-close {
  position: absolute;
  right: 10px;
  top: 10px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  width: 27px;
  height: 27px;
  color: #024985;
}

And that’s it! By using the technique above, you will achieve the following:

  • Seamless transition of website visitors from the old URL to the new URL
  • Redirect is a “301” redirect, Google’s recommended route of re-diverting visitors, thus retaining all SEO the domain change is permanent. Google will subsequently start re-deploying your SEO goodness to your new URL from your old one.
  • The user will land on the exact same page that they would have expected to be on (albeit, on the new URL/brand)
  • Notification message ensures users are not perplexed by any new branding.

Good luck, and do feel free to reach out to me if you need any assistance!

GET IN TOUCH FOR ANY HELP


mm

I am fanatical about providing useful web experiences, via bespoke websites which engage, inform and entertain. I have been making websites since a young age, and am a keen supporter of AFC Bournemouth.

Leave a Reply

Your email address will not be published. Required fields are marked *

Call Now on 01202 232553