Page 1 of 1

Phoca Open Graph plugin HTTPS -> HTTP

Posted: 04 Jul 2018, 22:47
by geriguy
Dear Jan,

We migrated our site to use ssl and redirected all of the former http pages to the https versions.
Because of this, Facebook reseted all of our likes, now the counters show 0 everywhere.

The solution would be to show the old urls in og:url tag. (I mean, the http versions, not the https versions).
Can you share the code to display the http://mysite/subpagexxxx instead of https://mysite/subpagexxxx?

I think I need to mod these lines, but don't know how:

Code: Select all

	//URL
		if ($this->params->get('url'.$suffix, '') != '') {
			plgContentPhocaOpenGraphHelper::renderTag('og:url', $this->params->get('url'.$suffix, ''), $type);
		} else {	
			//} else if ((int)$row->id > 0) {
			//$url = ContentHelperRoute::getArticleRoute($row->id);
			//$document->setMetadata('og:url', JRoute::_($url));
			$uri 	= JFactory::getURI();
			plgContentPhocaOpenGraphHelper::renderTag('og:url', $uri->toString(), $type);
		}
(You can read about the theoretic solution here:
https://orbitingweb.com/blog/http-to-ht ... ook-likes/
or here:
https://appscreo.com/recover-facebook-s ... -httpsssl/)

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 05 Jul 2018, 12:25
by Jan
Hi, Phoca Open Graph plugin does not work with the URL, it does not decide if this will be http or https, it gets the complete URL set by Joomla! : $uri->toString(), $this->params->get('url'.$suffix, '') :idea:

Jan

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 05 Jul 2018, 14:33
by geriguy
Hi Jan, thanks.
Isn't it possible to solve somehow to delete the single s character from the end of https after plugin made the request?

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 06 Jul 2018, 14:59
by geriguy
OK In theory I could solve the problem with this:

Change the code in plugin's php to:

Code: Select all

$this->renderTag('og:url', str_replace( "https", "http",$uri->toString()), $type);
An in addition

in htaccess:
"don't redirect facebook bot when reaching http site"
(RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9])

But because in Joomla settings, Joomla core redirects all visitors (even the facebook bot) to https from http, the solution isn't working...

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 06 Jul 2018, 15:28
by Jan
Hi, for now I really don't undestand what is the problem, see:

https://www.phoca.cz/news/983-phoca-car ... g-released

(site based on https), the meta tags:

Code: Select all

<meta name="twitter:image" content="https://www.phoca.cz/images/article/phoca-cart-sberbank.png" />
<meta property="og:image" content="https://www.phoca.cz/images/article/phoca-cart-sberbank.png" />
<meta property="og:url" content="https://www.phoca.cz/news/983-phoca-cart-payment-plugin-sberbank-acquiring-released" />
...
All the URLs get automatically https set by Joomla!

In Joomla! settings, there is Force HTTPS parameter enabled but not sure if this is needed. In fact I didn't solve this feature, Joomla! automatically set https so the plugin does't have any specific solution for this :idea:

Jan

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 07 Jul 2018, 09:36
by geriguy
OK, I explain.

At our website we had several hundreds of likes/shares for some of our pages.
We showed the counter to our visitors at the side of every page.

A week ago I installed an SSL cert and moved everything to HTTPS.
- I switched on Joomla force HTTPS,
- and also forwarded all of the traffic with adding a few new lines to .htaccess.

Everything worked as should, also Phoca OGP.

BUT!
Facebook counter started to show 0 likes, because https://mypage.hu is a totally different site than http://mypage.hu
It is not an error of Joomla or the error of Phoca. Facebook should realize that http site = https site, but it can't.


I tried to find a solution, and it seems, there is only one:
1., For Facebook it is needed to show the "old" http og:url tag. Even if you show https//mysite.hu/subpage og:url should write meta property="og:url" content="http//mysite.hu/subpage" />
2., You need to recrawl your page with facebook debugger
3., Facebbok crawler need to load/crawl not only the https://mysite.hu/subpage but also http://mysite.hu/subpage too.

If all 3 steps done, than your facebook like counter will show the correct data: http + https likes (cumulative)
Now I have problem with step 3. And it is not related to Phoca. At Phoca side, I could solve to generate og:url - http tag with changing that line in the code. Because in Joomla configuration force https/ssl is turned on, Facebook crawler can't scan my http page. Because of Joomla force ssl setting, Facebook bot has been redirected to https...

It would be a solution to switch of force SSL, but right now, I don't want to do that.

Re: Phoca Open Graph plugin HTTPS -> HTTP

Posted: 09 Jul 2018, 23:52
by Jan
Hi, yes, now I understand but I think, I cannot give any clue advice there as for now really no idea how to solve it :-( :idea:

Jan