解決opencart設置SSL後評論不能翻頁的問題

  爲了網站的安全和seo,咱們爲客戶的opencart網站添加了SSL加密實現https,並設置了301跳轉使http跳到https,基本全部的功能都無缺,就是有一點評論分頁沒法加載分頁,去分析了連接源代碼,發現分頁連接是http開頭的,http://www.cool.com/index.php?route=product/product/review&product_id=64&page=2,只要把這個http改成https就沒有問題,知道緣由就好解決了,咱們找到評論控制器文件/catalog/controller/product/product.php,大概556行左右php

$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}');

  怎麼改呢?ytkah在Stack Overflow上找了一圈,有個提示安全

That's because the helper is designed to output URLs intended for use in HTML, where the & will be correctly parsed. Echo out your generated link and view the page source, or look at your shop links and you'll see what I mean.

If you dig deeper and look at the top of the account/account controller, you'll see this:

$this->redirect($this->url->link('account/login', '', 'SSL'));

  這個不就是ssl嗎?咱們試着改造一下網站

$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}', 'SSL');

  果真能夠,翻頁正常加載了!感興趣的朋友也去試試吧this

相關文章
相關標籤/搜索