The question is based on the question [htaccess rewriterule: redirect http to https or https to http (both ways) depending on URL typed](https://stackoverflow.com/questions/8945946/htaccess-rewriterule-redirect-http-to-https-or-https-to-http-both-ways-depend). The great solution (thanks to Ulrich Palha) looks like this:

```
RewriteEngine on
RewriteBase /

#determine if page is supposed to be http
#if it has p=home or p=home1 or qqq=home in querystring
RewriteCond %{QUERY_STRING} (^|&)(p=home1?|qqq=home)(&|$) [NC,OR]
#or if query string is empty
RewriteCond %{QUERY_STRING} ^$
#set env var to 1
RewriteRule ^ - [E=IS_HTTP:1]

#all pages that are supposed to be http redirected if https
RewriteCond %{HTTPS} on
RewriteCond %{ENV:IS_HTTP} 1
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]

#all other pages are sent to https if not already so
RewriteCond %{HTTPS} off
RewriteCond %{ENV:IS_HTTP} !1
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]

```

Unfortunately, once I add this code to .htaccess file, everything works fine, but https started look broken, if contains links to css or pictures from the server, although the paths are relative.

The page below (<https://www.example.com/?p=welcome>) displayed with a broken SSL connection, FF browser says "Your connection to this site is only partrially encrypted"

```
<head>
<title>ddd</title>
</head>
<body>
Hello
<img src="/gfx/stars/help.gif" alt="" /> 
</body>
</html>

```

Why?

Once I remove `<img src="/gfx/stars/help.gif" alt="" />` from the page , FF displays https fine, the URL bar is green then (SSL certificate is displayed). The same error appears, when I test it using Google Chrome.

So, what's wrong with `<img src="/gfx/stars/help.gif" alt="" />`? The path is relative.
The same happens if I add

```
<link rel="stylesheet" type="text/css" href="/css/mycss.css" />

```