2

Running an Apache web server, if I use an .htaccess file to redirect all my http:// traffic to https:// using something like

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

will that preserve all of my "link juice" since Google considers my http site to be different than my https site? Is it safer and/or more accurate to implement 301 redirects?

Additionally, in a Wordpress site, is it SEO-safe to change the site address in the general settings from HTTP to HTTPS and maintain the link juice?

1

If your redirection will be a permanent 301 from http to https, it should be fine.

Whether you do 301 redirect using .htaccess or using the code, as long as the server response is permanent 301 then you should be fine.

If you will not set the redirection (301) the Google may treat http and https as separate urls and it causes duplicate content and ranking issues.

Once the redirection is implemented you can use an online redirect checker to ensure the response is 301.

Note: You also need to make sure your other versions of URLs redirect to preferred HTTPS. You can also use preferred and other URLs tool to ensure you are covered.

Ranking Drop: If the website is in healthy condition, there will be no impact on ranking if redirection is done well.

If you may have set canonical in the code then you will need to address that too.

Wordpress: You will also have to apply required changes in .htaccess apart from changing in WP settings.

  • I guess that makes sense that in a Wordpress environment the server will look at the .htaccess rules before looking at the site URL that Wordpress is set to since that is stored in the database. – Talk Nerdy To Me Apr 3 '18 at 15:39
1

301 Impact

To answer your primary question about losing Juice, yes, you lose a little bit of it. The problem is that all the external links will be using HTTP to your site and now all those links will include a 301...

An External Site has a link to one of my page: http://my.website.example.com/this-page. Google finds that page on that Site and registers that link. At some point the GoogleBot spider decides to follow that link, it receives a 301. Register the destination of that 301 and add a small penalty to that link because of it. Yet later, it checks the 301 destination and finds my page. This time it worked as expected the spider got a page. The spider assigns that backlink juice to that page ranking, but with that small penalty because of the 301.

So in you current scenario, you'd be hit by the small 301 penalty. If you had a big site with many external links pointing to your site, you'll certainly notice an impact. If you have a small site with just a few external links and a few hits per month (like under 100,000) then you won't notice a thing. If you have a big site with millions of hits, you probably will notice a small change.

The way large sites do it is by:

  1. Having the two versions running simultaneously,
  2. Making sure to let Google Console know of both versions and which one is preferred (i.e. HTTPS in your case.)
  3. 301 redirect newly created pages--so in other words, never create additional HTTP-only pages after the switch (I don't know whether WordPress would have that capability?)
  4. Make sure that old pages on the HTTP website now show "https://www.example.com/..." in their canonical URL.
  5. Fix all the internal URLs that include the protocol (http:...) to now use the new protocol (https:...)--for this, WordPress has plugins that will help when converting your site from HTTP to HTTPS.

I don't think WordPress allows you to do all of that without a lot of work. Like Google, WordPress sees both versions of the site as two separate websites and thus would probably not work correctly anyway. So really I would skip on it. Unless you have a million dollar website, it's probably not worth the trouble (a.k.a. additional costs) anyway.


About the redirect

If you can edit the .conf file instead of the .htaccess, you can add that redirect to your VirtualHost instead. That allows you to remove the RewriteCond %{HTTPS} off.

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com
  ...other parameters...

  RewriteEngine On
  RewriteRule (.*) https://example.com/\1 [L,R=301]
</Virtual>

Here I redirect everything to https://example.com/ keeping the path untouched.

Note that I removed the ^ and $ since they are not needed. .* by itself matches the whole path from start to finish. I think it also makes more sense to use \1 (and that's why you have the parenthesis!) since you just parsed that with the .*.

On my end, I also started using the verbose version of the RewriteRule flags to make things clearer in my Apache code:

[last,redirect=permanent]

I don't show it above, but if you want to preserve the query string, you need the qsappend as well:

 RewriteRule (.*) https://example.com/\1 [last,redirect=permanent,qsappend]

That way http://www.example.com/?page=3 will work as well. Without the qsappend it will just become https://www.example.com/ and no page information will show up... in other words, the user is sent to the wrong place. Google would probably not be happy about that!

0

I’d recommend putting this into apache virtual host file and make ssl required so it doesn’t even display anything insecure at all. /etc/apache2/sites-available/default-ssl.conf and use port 443. Look this up for more. Basically you tell apache to do this when web requests are coming in. I’d recommend against 301 way as this negatively effects SEO

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.