Additionally, paste this code immediately after the opening tag:
Redirects

HTTPS 301 REDIRECTING VS DOMAIN FORWARDING

How you should redirect from a secure site (HTTPS or SSL) to another secure site that’s a different domain name.

After recently re-branding our domain to be the clean and secure version of https://www.laseoservice.com, we ran into an interesting snag when 301 redirecting from our old domain to the new one. This documents how you should redirect from a secure site (HTTPS or SSL) to another secure site that’s a different domain name.

WHY DOMAIN FORWARDING WON’T WORK

When we were at the point of having a thoroughly QA’d new site from a brand design, UX and SEO perspective, we were ready to pull the trigger and redirect losangeles-seoservices.com which was our live domain name, to 301 redirect to laseoservice.com. After all, we’re a SEO agency and wanted to make sure we retain our top notch rankings for our own site. The new domain name is actually one that we’ve owned for years and is what we use for email and branding. So it was a logical move for us strategically.

When we were ready to point to the new domain as our shiny new site, we simply logged into our domain manager account and forwarded to the secure version of our new site. We intend to keep the new site secure like the previous one for several reasons. Primarily for user privacy and since we have a sign up page where credit card info can be submitted.

When you forward your domain name to a new one, you have to play the waiting game for the new destination to propagate which is nerve wracking when you have down time. The problem we ran into with the forwarding method is it only redirects the http version of the original domain and not the HTTPS version. Since our site had been indexed by Google as the secure version, we weren’t redirecting users properly and had dead time which would have severely impacted our rankings if we didn’t solve it correctly.

An interesting side note, we hopped on 4 calls with domain and hosting support at GoDaddy and nobody was able to figure out the issue. While their support is usually very solid, you could tell that SSL is a newer beast that most weren’t familiar with. Each call had a frustrating ending without resolution besides saying:

It's still propagating, give it more time

HOW TO IMPLEMENT THE HTTPS REDIRECT IN .HTACCESS FILE

The route that finally resolved our redirecting issue took us back to our trusty .htaccess file. We realized that the SSL certificate exists at the server level. So domain forwarding simply isn’t the right solution. We included the following code in the htaccess file used for the original hosting account to point to the new domain and enforce the secure www version which is how we want the new domain to display. (Simply change our domain name to be yours)

See the script on Github here:

https://gist.github.com/laseoservice/30041e195e8f7c8ead088f1a6d85435d

BONUS! How To Implement both HTTP and HTTPS Redirecting in .htaccess

Since you want to make sure all previous links out on the web redirect to your new domain, you’ll want to redirect both the secure and non-secure versions of your old site. To do this, we wrote the following to take care of all possible redirect scenarios and to enforce redirecting to the new www secure version of our new site. (Simply change our domain name to be yours)

See the script on Github here:

https://gist.github.com/laseoservice/c0e708bbb797812691f978a9bef5cbbc

The End Result?

All of our links built organically over time now redirect correctly over to our new secure domain. We wrote the redirect in a way that regex redirects the previous domain’s pages to their new same matching page on the new domain as well. All of these methods combined will ensure to keep optimal rankings and the best user experience in tact. When you find yourself in a similar situation where you are looking to redirect from HTTPS to another site, be sure to implement the redirect in htaccess and save yourself the headache of downtime. Or worst off, long term rankings and traffic decreasing due to incorrect redirecting.

It's technical challenges like these that fuel our love for SEO each and every day!
Max file size 10MB.
Uploading...
fileuploaded.jpg
Upload failed. Max size for files is 10 MB.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.