Forum Moderators: phranque

Message Too Old, No Replies

ssl warning contains unauthenticated content

CSS and JS links is not being read as https in https pages

         

zaira_86

10:09 am on Mar 21, 2010 (gmt 0)

10+ Year Member



I have this htaccess rule below to redirect my login page, contact page and confirmation page into https but the page is isn't 100%secured because the css and javascript links was not automatically change into https it is still in http. I got SSL warning "warning contains unauthenticated content".

htaccess code

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(login.php|contactus.php|confirmation.php)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{SERVER_PORT} ^443$
RewriteRule !^(login.php|contactus.php|confirmation.php)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


This is how i declared css and js links.

<link rel="shortcut icon" href="/images/favicon.ico" />
<link href="/css/global.css" type="text/css" rel="stylesheet"/>
<link href="/css/login.css" type="text/css" rel="stylesheet"/>
<script type="text/Javascript" language="Javascript" src="/js/checker.js"></script>


What do i need to do to fixed the ssl warning? Any idea please? Do i need to add something in my htaccess?

jdMorgan

2:31 pm on Mar 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to exclude the .css, .js, and all image-filetypes from being redirected by either rule by adding a RewriteCond like

RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|jpe|ico|css|js)$

to both rules.

You may need to modify that pattern if you have additional "included-object" types that you "share" between http and https. Try to keep the subpatterns in order from most-frequently-requested filetypes to least for optimum performance (check your stats to see which are requested most often) -- Every little bit counts.

Jim