using modrewrite to change http to https? (not redirect)

Posted by PaulHanak on Server Fault See other posts from Server Fault or by PaulHanak
Published on 2012-09-03T18:11:17Z Indexed on 2012/09/03 21:39 UTC
Read the original article Hit count: 207

Filed under:
|

This might sound a little crazy, but bare with me. I basically have an include file, lets say inc-navigation.html, that has absolute paths (http://www.pathtoimage.com/image.com) that are on EVERY PAGE. Well, using SSL, I can't use that same include file because it is not referencing https:// What a pain!

SO, I was maybe thinking of using htaccess to do a url rewrite of all references of HTTP to HTTPS when the browser requests a https page. Again, just to be clear, I don't want to "redirect", just "replace".

So, I have this....

RewriteCond %{HTTPS} !=on 
RewriteRule ^http$ https

but it doesn't seem to be working. I probably have the syntax wrong though. :) Of course, this is even if this type of thing is even possible!?

© Server Fault or respective owner

Related posts about mod-rewrite

Related posts about ssl