• Home
  • Get help
  • Ask a question
Last post 11 hours 54 min ago
Posts last week 89
Average response time last week 30 min
All time posts 67735
All time tickets 10467
All time avg. posts per day 21

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#4397 – switched to https, but want to set canonical to http

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Thursday, 07 December 2017 13:35 UTC
webfeuerflo
hello,
my client has a site that has collected many facebook likes over the years. I switched the domain to https and all the counters are reset to 0. I now found a social sharing plugin that has the option to force the http-version, that means, although you are on hte https-version of the page, you are actually liking the old http-version, which is fine, because it brought back the old numbers and if anybody clicks on the link he gets redirected to the correct https-version.

BUT: it seems as it is only showing the old http-numbers as long as nobody interacts new with it. It tested it in the facebook-debugger. if I enter the old http-URL it shows me the correct numbers. If I enter it again, it says, 'hey the canonical URL is https!" and resets the counter.

Is there a way to insert a http-version as canonical URL to all pages, so that facebook accepts the old-likes even on the new https-version?

I know it is very confusing, but I am really puzzled when facebook is showing which numbers.

thank you 
Thursday, 07 December 2017 19:45 UTC
wb_weeblr
Hi

sh404SEF does not handle the domain (or scheme: http vs https) of your site. This is done entirely by Joomla, we only take care of URLs from the first "/".
Joomla lets you select your canonical domain in the settings of the SEF system plugin, so that's where you want to go to globally change your canonical to something else than the real site.

I would however 100% advise against this, it will most certainly have a very negative effect on your SEO: you are creating a redirect loop when doing this: Your site is served over https, but you insert a canonical to the HTTP version. But when ones (and Google) go to the HTTP version, they are 301 redirected to the HTTPS version. So which one should search engine use?
They don't know, and so they might choose one or the other. You may be able to fix that by selecting HTTPS in Google Search console, but this goes against every SEO principle.

I would instead:

1 - Just forget about the old articles item counts. Many sites actually remove those counts, you never know if they have a positive or negative impact.
2 - If you insist on having those for your old articles, pre-switching to HTTPS, you will have to work on it and use one of sh404SEF hooks to modify the URL included in the OGP tags that Facebook use. This would be something like that:

<?php
/**
 * sh404SEF hooks file
 */

defined('_JEXEC') or die();

function t4397CustomTags($tags)
{
	$app = JFActory::getApplication();
	$option = $app->input->getCmd('option');
	$view = $app->input->getCmd('view');
	$id = $app->input->getCmd('id');
	if ('com_content' == $option && 'article' == $view)
	{
		$tags['url'] = str_replace('https://', 'http://', $tags['url']);
	}
	return $tags;
}

ShlHook::add(
	'sh404sef_ogp_tags',
	't4397CustomTags'
);


This code should be placed in a file called "sh404sef_functions.php", located in the "/libraries/weeblr" folder.

This is a simplified example. I would suggest you make it a bit smarter and only set back the URL to HTTP instead of HTTPS for articles older than a certain date, so that newer articles are assigned to their HTTPS URL. And of course it should be adjusted if this is not about com_content.

Rgds
 
Friday, 08 December 2017 13:45 UTC
webfeuerflo
hello, thanks for your answer. I tried a different approach. My client insists on having the old likes. So I use the plugin that allows me to actually like the old-http-URL, this works and shows the old likes as long nobody interacts with the button. If is is liked again or the facebook debugger checks it again, it notices the 301-redirect and the likes are reset. So I had to edit another plugin that is delivering the OG-tags in my site, so that it puts the http-URL in the OG:url-tag and not the https-version. I then excluded facebook from the 301-redirect using this in my htaccess:

RewriteEngine On
RewriteCond %{HTTPS} !^on
RewriteCond %{HTTP_USER_AGENT} !(Facebot|facebookexternalhit/1.1) [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

what do you think about that?
It seems to work and should not affect SEO, I believe?
Friday, 08 December 2017 13:47 UTC
webfeuerflo
well, upon reading your answer again, it seems as if it is more or less the same solution, only that I use another plugin for the OG-tags, that allows me to define a default image. And I think to exclude facebook from the 301-redirect is also crucial.
Friday, 08 December 2017 15:07 UTC
wb_weeblr
Hi

If you put the http url in the og tags, you don't need anything else really. Google would certainly penalize you for having a specific redirect for them, but I think Facebook would not mind.

As you are only using other plugins for your OGP tags, there's not much to add from us I think, except maybe that if you were to use sh404SEF OG tags generation, you would:

- get a default image
- easily run your own custom code, as shown above, without having to modify a plugin (which means no update allowed, or you'll have to redo your changes) The code above will survive any sh404SEF update.

Rgds
 
Monday, 11 December 2017 08:39 UTC
webfeuerflo
thank you for your feedback! I choose the other og-tag-plugin, because my client wanted to have a default image, and only if the article has an intro image, this should be chosen. I did not see how I could configure this with sh404sef
Monday, 11 December 2017 08:47 UTC
wb_weeblr
Hi

Not sure what you mean by a "default" image now. A default image is what you use when no image is found in the article itself (ie automatic detection cannot find any suitable image).

Automatic detection first look at intro or full article images presence. Then if not found, it scans the article content for an image (larger than Facebook minimal size). You can select to use either the 1st image found in content, or the largest image in content. Then if nothing is found in content, sh404SEF will search the full page content for a suitable image. If nothing found, it will resort to the default image set in configuration. Of course, you can also set a specific image for each URL.

Rgds
 
Monday, 11 December 2017 08:53 UTC
webfeuerflo
Yes, I understand. My client wants to have one image that is used as sharing image for all shared URLs except where he sets an intro image for the article. He does not want to have other images being used, because he feels that this is the only way he can control what facebook actually uses. In the article the image sizes/proportions could be very different and he would never know how it turns out. In his case, most of the time the article images didn't have the right size and the sharing dialog breaks out of the article and starts using images from the header slideshow or some module, and they may have nothing to do with the URL.


So he designed one sharing image for all, except for the few cases where he sets a specially designed intro-image.
Monday, 11 December 2017 09:54 UTC
wb_weeblr
Hi

That would be achieved in sh404SEF by setting the default image in configuration, and then picking a specific image for a given page, in the URL manager. That way you do not have to change the layout for articles depending on whether they have an intro image or not.

And as outlined before, it can also be done programmatically for instance. sh404SEF has been around a while, it's fairly flexible.

Up to you/your customer anyway.

Rgds
 
Tuesday, 26 December 2017 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.