If you are running a website be it a personal blog or corporate website, most browsing client like Chrome and Mozilla are requiring you to use a secure web protocol HTTPS. Moreover, Google will be giving priority to those sites that are already in HTTPS from Search Engine Optimisation aspect.
Amending your website resources to use a secure protocol is a bit tricky but this article will guide you to do some tricks in Apache configs in .htaccess file.
The regex codes below are using mod_substitute apache module:
This will find links for href
attributes and substitute url value
Substitute "s|(href[^http://]+)(?<=['\"])http(?=://)|$1https|"
This will look for src
attributes particularly images, JS scripts and replace the url value
Substitute "s|(src[^http://]+)(?<=['\"])http(?=://)|$1https|"
Find forms and look for action
attributes and replace url value
Substitute "s|(action[^http://]+)(?<=['\"])http(?=://)|$1https|"
I may gonna miss some other resources and other points, just feel free to comment below. Also for those resources that are using DOM, you can also use a jQuery to modify it e.g. when the document is loading modify links that are generated by DOM.
Read more..