Bifter
Bifter

Reputation:

SSL - pointing all assets to https

What is the best way to make sure all assets(images etc.) are https://.... on all secure pages so that the ssl cert shows in browser address bar?

Upvotes: 0

Views: 258

Answers (3)

Shoan
Shoan

Reputation: 4078

I use the following rewrite code in apache to redirect any non secure traffic to https://

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Upvotes: 1

Sesh
Sesh

Reputation: 6182

Create a top most folder for your application and place all the components/assets within this folder. Make sure the topmost folder requires SSL.

Also from best practices point of view, something for discussion:

Do you really need SSL for your images? Unless there are some captcha images or other security requirements, consider not using SSL for images - it saves both n/w and server/client CPU.

Upvotes: 0

David M
David M

Reputation: 72880

Use relative addresses for them!

Upvotes: 4

Related Questions