Recommmended settings with additional https site?
-
I might be a bit out of topic here, but you’re such a clever guy Sybre, maybe you can share a quick recommendation?
I’v just acquired a SSL certificate for my sites, so now for instance my personal blog is available at both
http://oldrup.dk/
https://oldrup.dk/I’ve read all sorts of blog posts regarding canonical links and duplicate content but there seems to be many myths.
Are there any easy settings in The SEO Framework I should be aware of?
Best regards
Bjarne
-
Hi Bjarne,
The SEO Framework handles SSL automatically by detecting the current site’s state.
In the future (I assume 2.8.0 or through an extension), I’ll add ways to add priority to certain schemes.The most important thing is the Canonical URL in this case.
This URL will change dynamically to the set scheme, which is expected behavior (but not recommended).
So it’s a high-priority update :), because those myths are true to a certain extend.For now, you’ll simply have to change the site’s URL at WordPress General Settings (the second website URL entry).
I recommend HTTPS, as Google favors secure websites over non-secure.If WordPress doesn’t redirect the user automatically to HTTPS, you can do several things.
a. Adjust .htaccess
.htaccess adjustments are the fastest way to force website interaction. As this handles things right into the Apache/Nginx core prior to loading the website. So no (slow) PHP handling is needed. This is at least 1000x faster, up to a few million, compared to PHP redirects.The code you’ll need:
RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^oldrup\.dk [NC] RewriteRule ^(.*)$ https://oldrup.dk/$1 [R=301,L]Be sure to adjust the WordPress site URL before, otherwise you might encounter a loop.
b. Adjust the Canonical URL:
If you’ve forced the scheme within .htaccess, this is not needed. As The SEO Framework detects the scheme automatically.
When Google encounters a canonical URL that’s different from the current website, Google will abort crawling the current page and will follow that URL and continue from there.
Within The SEO Framework, there’s a filter available so it’ll canonicalize all URLs to a certain scheme:
add_filter( 'the_seo_framework_canonical_force_scheme', 'my_scheme_filter' ); function my_scheme_filter( $new_scheme = null, $current_scheme = '' ) { //* Only adjust on front-end. You might need to fiddle a bit. if ( 'https' !== $current_scheme && ! is_feed() ) { $new_scheme = 'https'; } return $new_scheme; }That’s it :).
I hope this all clears things up!Thanks again Sybre. Always a pleasure 🙂
An update on the transition from http to https on my blog
I used the Better Search Replace plugin to change my media urls to relative urls, ensuring me a green padlock on https://www.whynopadlock.com/check.php
Once both the http and https version of mit site worked perfectly, I changed the WordPress Site URL to https:/oldrup.dk. Now the site defaulted to https if I just entered oldrup.dk in the address bar.
But I was still able to visit the http version entering a complete url like http://oldrup.dk. Wondering if that might hurt google ranking due to duplicate content, I added the snippet you provided to .htaccess – and it works perfectly – its important to insert the snippet in the top of the .htaccess file though, otherwise my sub-pages weren’t redirected.
Lastly, I changed my urls in analytics and search console. The next weeks will show if google re-indexes my pages to the new https address, and if my search ranking stays good 🙂
Thanks a bunch Sybre for helping
Hey Bjarne
Thanks for your follow up report. And the whynopadlock link.
I have followed your steps but still have a couple of unresolved issues. Perhaps you know the answer?
https://wordpress.org/support/topic/moving-from-http-to-https/#post-8189456
Kind Regards
Max
Hi Bjarne, Max,
I’m sorry I forgot about this topic! The new forum ordering system is not optimal.
Both the HTTP and HTTPS websites are considered separate. This means there’s concern for duplicated content.
So, when the site is accessible on both HTTP and HTTPS, be sure to set a preferred scheme.
This will become a new feature in version 2.8.0 of The SEO Framework, so from then you won’t need the filter I described earlier.For the best results, be sure to set a 301 redirect in your
.htaccessfile and do make sure it works as intended: a forced redirect to https, always.@khunmax I’ll get back to you on your topic. Please keep this reply in mind.
Thanks and have a wonderful day!
Oh – I actually forgot this thread was open as well, actually thought of it as solved 🙂
I’m using the .httacces snippet…
RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^oldrup\.dk [NC] RewriteRule ^(.*)$ https://oldrup.dk/$1 [R=301,L]… mentioned earlier, all the time now – of course replacing the domain name. Migrated 5+ domains to https and it just works. Using WordFence for security and built in caching, no issues there either. Added the “new” https site to google search console, and it has been picking up the new url’s nicely. A slight performance hit (expected) but no google search results hits on selected keywords.
Ensuring encrypted and safer sites is easier than ever. I’m going to do that up front from now on, see no reason not to.
Thanks again for your invaluable help Sybre.
– Bjarne
The topic ‘Recommmended settings with additional https site?’ is closed to new replies.