Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why images and CSS do not show under HTTPS?

Tags:

I just added an SSL to my site. When I go to https://mydomain.com I see the text but no CSS or images are there. It is on a dedicated server and I have a full control of the code.

All paths currently are relative. I can view images and css when I go to those files directly whether using HTTP or HTTPS. But when i load a page they are not loading...

When I use Firebug and look in NET, I see for each image 302 Found. What does that mean?

What changes do I need to make to make sure http and https display site similarly?

Do I make all paths absolute? Is there a way to make a single change to affect all or I actually have to go and change each and every one?

Thanks.

like image 922
santa Avatar asked Oct 27 '11 15:10

santa


People also ask

Does display none prevent loading?

Unfortunately not. Any image in an <img> element will load all the time no matter what you do.


2 Answers

Do you have hotlink protection? If you have try to disable it. And see if it helps.

like image 148
ilhan Avatar answered Sep 20 '22 11:09

ilhan


You don't need to make everything absolute, but you need to make sure that your CSS and images are accessible over SSL. Try accessing them directly, or use Firebug or a similar browser tool to figure out where it's trying to load them from. Consider using "Protocol-relative URLs" so that CSS, images, and such are always accessed using the same protocol (http or https) as the page itself. http://paulirish.com/2010/the-protocol-relative-url/

like image 42
Dan Avatar answered Sep 18 '22 11:09

Dan