Post by seers » Fri Nov 23, 2018 6:30 pm

Hello to everybody!

I have managed to implement canonical tags in my category pages but the issue is that they are pointing to the http:// version insted of the https://

The canonical tag for the homepage is OK and pointing to the correct https:// version.

The whole site is running on ssl and there are no other issues besides the category canonical.

I have searched for a solution but failed to find one that works. I can paste any code from the site if it is needed by some of you for ideas.

The OC version is 2.2.0.0.

Thanks in advance!

Newbie

Posts

Joined
Fri Nov 23, 2018 6:17 pm

Post by OSWorX » Fri Nov 23, 2018 9:04 pm

First of all, using 2.2.0 is not a good Idea, if possible use 2.3.0.2 (should be easy to update, but try it NOT on the live site!).

Second, to use all URLs with https, you can edit the
..system/library/url.php
look for

Code: Select all

public function link($route, $args = '', $secure = false) {
and change to

Code: Select all

public function link($route, $args = '', $secure = true) {
Enable also the Setting for SSL in the backend (which is/should already enabled if all other are https).

Second (second method) - edit the 2 config.php and change http to https (this will also force the https to all URLs).

Optional and/or additional:
Third: edit your .htaccess and force to use only https URLs

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by seers » Fri Nov 23, 2018 10:31 pm

Thanks for the reply and tips.

I tried the first two methods and unfortunately there is no difference.

I am not sure how to properly edit the .htaccess file to achieve my goal, having in mind that ssl is properly working on the whole site except on canonicals on category pages.

I found and used the following tip to implement the canonical tags for categories in the first place:
Visit this location in your store: catalog/controller/product/ and open the file category.php.
Find the following line of code:
$this->document->setDescription($category_info['meta_description']);
And below it add this code:
$this->document->addLink($this->url->link('product/category', "path=".$this->request->get['path']), 'canonical');
This will produce the canonicals on every category and sub-category page.
Any other suggestions based on the above code?

Newbie

Posts

Joined
Fri Nov 23, 2018 6:17 pm
Who is online

Users browsing this forum: No registered users and 16 guests