301 Redirect from HTTP to HTTPS – SearchCast



[formcraft id=’6′]

Transcription

The Magic Code:

# SSL Rewrite
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourwebsite.com/$1 [R=301,L]

Today we’re going to be talking about how to set up an HTTP to HTTPS 301 redirect. Recently I was going through my Moz Pro membership and I was looking at all of our redirects, making sure that everything was done correctly, and I noticed when I had done the SSL something had gone from HTTP to HTTPS, which was great. I’ve got a nice little article on it. The problem was it was a 302. Now, this is a simple problem to fix so here’s how we’re going to talk about how to go from a 302, which is pretty standard in most of the resources you find on how to go from HTTP to HTTPS, to go to 301 so we pass all that link equity. It’s a really important little thing to do.

Here’s what we’re going to do. We’re going to go over to our cPanel and we’ll go to our .htaccess file. So first the little public_html, we’ve got multiple websites on here. We’ll get our .htaccess file, edit. You can just do it all in here. No need to go through the FTP. You’re going to see right here the code that we’re going to use for it. Super, super simple, so it’s rewrite engine on, rewrite condition, rewrite rule, and then you can just do HTTPS right here directiveconsulting.com.

Here’s the tricky part, R=301 this is redirect equals 301. Here’s a number one ranking article normally on this I found. It’s 301 redirect from HTTP to HTTPS. But what they did was they only gave me this rl. Now I’m not a programmer and I don’t have necessarily all the expertise I want yet, but what I noticed was that this was sending it as a 302 instead of a 301.

We do the equals 301, we’ll get that what we want. Then it’s a WordPress site so to make sure everything was firing correctly I just used this HTTPS plug-in. You guys see my settings right here. Super, super simple basic settings, nothing crazy done, and now I got this nice little site lock and everything’s working perfectly.

Thanks for watching and once again what you’re going to want to do to get your 301 redirect from HTTP to HTTPS, go to your .htaccess file, click edit, copy paste. Don’t forget to change your domain here. All you have to do is copy this code and from there you’re good to roll.

Thank you for watching and this is the first episode of Search Cast. Thank you.

Garrett Mehrguth is the CEO and co-founder of Directive Consulting – a global search marketing agency headquartered in Southern California specializing in comprehensive search marketing campaigns for B2B and enterprise companies.

Did you enjoy this article?
Share it with someone!

Stay up-to-date with the latest news & resources in tech marketing.
Join our community of lifelong-learners (1000+ marketers and counting!)

Solving tough challenges for ambitious tech businesses since 2013.