wordpress posts

WordPress plugin: changing rel-canonical

I serve my site over both HTTP and HTTPS to support older browser that can’t support modern or any HTTPS protocols. I prefer HTTPS for search engines and general use though, as it is more secure, increases user privacy, and is factored into SEO rankings. Due to an issue with my sitemap, Google ended up indexing all of my blog pages as HTTP. The first thing I’m going to try to get Google to show my blog pages as HTTPS is to set the rel-canonical link to the HTTPS version regardless of which protocol the visitor uses. WordPress doesn’t have a built in way to change the canonical URL, and I didn’t want to install a heavy SEO plugin just for this, so I wrote my own.

This simple plugin removes WordPress’s rel_canonical action, then replaces it with its own. I basically re-implemented WordPress’s own functionality, replacing the http with https before outputting the link. It looks like:

Continue reading post "WordPress plugin: changing rel-canonical"

I was using Jetpack’s sitemap plugin and even submitted it to Google until I noticed that it had the wrong protocol for all of the post URL’s. Now Google has a bunch of ‘http’ URL’s for my posts in its listings, even though they are available over ‘https’. I couldn’t figure out how to change the protocol (there is no config or documentation about where that is coming from) so I just disabled the sitemap for now.