【问题标题】:Forcing HTTPS is breaking my page design强制 HTTPS 破坏了我的页面设计
【发布时间】:2013-02-13 03:46:49
【问题描述】:

https 破坏了我网站的设计。请看www.pawpost.com.au/index.php

如果有帮助的话,我正在使用 opencart。

我在管理员/系统中启用了 SSL

配置文件:

// HTTP
define('HTTP_SERVER', 'http://www.pawpost.com.au/');
define('HTTP_IMAGE', 'http://www.pawpost.com.au/image/');
define('HTTP_ADMIN', 'http://www.pawpost.com.au/admin/');

// HTTPS
define('HTTPS_SERVER', 'http://www.pawpost.com.au/');
define('HTTPS_IMAGE', 'http://www.pawpost.com.au/image/');
define('HTTP_ADMIN', 'http://www.pawpost.com.au/admin/');

.htaccess:

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.pawpost.com.au/ [R]

对此有什么想法吗?快把我逼疯了。

试过了:

  1. 仅在管理员中启用 SSL 时。
  2. SSL 'on' 和上面的配置文件。
  3. SSL 'on' 和 .htaccess 按照上面的方式。
  4. 启用 SSL、.htaccess 和配置文件。

【问题讨论】:

    标签: .htaccess https config


    【解决方案1】:

    尝试更新您定义为使用 https 的 HTTPS 链接:

    // HTTPS
    define('HTTPS_SERVER', 'https://www.pawpost.com.au/');
    define('HTTPS_IMAGE', 'https://www.pawpost.com.au/image/');
    define('HTTP_ADMIN', 'https://www.pawpost.com.au/admin/');
    

    【讨论】:

    • 谢谢!这么小的事情很容易被忽视(至少我们这些傻瓜),这真是太好了。
    【解决方案2】:

    看起来您的图片引用了 http:// 路径。您需要将图像和 CSS 文件的任何路径更新为相对路径或绝对路径,以在其中包含 https://。

    【讨论】:

    • 我可以在我的配置文件或 .htaccess 中执行此操作吗?还是我必须遍历每个文件才能手动更改?
    • 我会亲自更改它。如果你有 shell 访问权限,你可以编写脚本来打开每个文件,并将 http:// 替换为 https:// 找到它。
    • 这样的事情可能会奏效。 (我没有测试过) [code]find . -name "*.html" -print | xargs sed -i -e 's/
    最近更新 更多