zoukankan      html  css  js  c++  java
  • 解决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行左右

    $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');
    

      果然可以,翻页正常加载了!感兴趣的朋友也去试试吧

  • 相关阅读:
    java环境变量配置 tomcat配置
    asp.net 数据库连接 使用事务处理(一)
    css3 渐变gradient
    asp.net 数据库连接类 (一)
    某某系统HTML脚本植入测试
    BitmapFactory.Options.inSampleSize 的用法
    Comparator和Comparable在排序中的应用(转)
    学习PrintWriter类
    Android使用ListView注意事项
    Android之SurfaceView学习(转)
  • 原文地址:https://www.cnblogs.com/ytkah/p/10825952.html
Copyright © 2011-2022 走看看