Forum

Thread tagged as: Problem

Perch 2.0.4 SSL

My client is running a very old version of Perch (2.0.4) and recently bought and installed an SSL cert. When the following is added to the .htaccess file:

#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://somesite.com/$1 [R=301,L]

the resources (images and videos) that were previously embedded/uploaded via the Perch UI display fine, but any images outside of Perch, i.e., referenced from the stylesheet or hard-coded in a template, do not display.

External files (stylesheets, js) are referenced in the head tag like this:

<link rel="stylesheet" type="text/css" media="screen" href="/css/global.css" />
<script type="text/javascript" src="/js/global/external.js" language="javascript"></script>

What am I missing?

Todd B

Todd B 0 points

  • 3 years ago
Simon Clay

Simon Clay 127 points

When visiting the site with https:// the browser will block any resources (internal or external) that start with https:// to keep the connection secure.

Todd B

Todd B 0 points

Right, I understand that part.

But even when I use the full url to say, the stylesheet,

<link rel="stylesheet" type="text/css" media="screen" href="https://somesite.com/css/global.css" />

the images (referenced in the stylesheet) still do not appear. Why is that? What's the solution?

How are the images referenced in the stylesheet - can you post an example?

Simon Clay

Simon Clay 127 points

I would expect the browser to load that. Are there any references to resources with https:// within the stylesheet?

The browser inspector show what mixed content is not being allowed to show.

Todd B

Todd B 0 points

The images in the stylesheet are referenced like this:

background-image: url(../resources/some-image.png);
Simon Clay

Simon Clay 127 points

If you right-click and choose 'inspect' on an image that is missing what does the browser say?

Todd B

Todd B 0 points

Here's the error:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (hotlinkp.gif, line 0)

and next to the above error is this:

https://img148.imageshack.us/img148/732/hotlinkp.gif

I have absolutely no idea what the “imageshack” stuff is about.

It's the same for every missing image.

Todd B

Todd B 0 points

Solved.

Found a problem in the .htaccess.

Simon Clay

Simon Clay 127 points

Great. What was the problem?

Todd B

Todd B 0 points

There was an unknown .htaccess file in the folder containing the images that had something to do with the imageshack error above. Looks like it might have been auto-created by the server to prevent hotlinking. I know I didn't put it there.

It was blocking the images from rendering.