# Convert your sitelinks to https with sededit

I’ve wrote before the small post on how to find and substitute the string in all files with sed command in GNU/Linux. Now I’d like to show the real use case.

You’ve bought a new SSL certificate and configured your web server. After you fire it, you can make an unfortunate discover when you open the browser on your brand new https://example.com, that it says “Some parts of this page are not secure”.

So what is insecure? Simply you may have used the insecure contents like images or extenal JS libraries loaded from CDN.

To help with this, Linux has a small and powerful command to find and substitute the old_phrase with the new_phrase in all files and directories recursively - it is sed command on GNU/Linux

find . -type f -print0 | xargs -0 sed -i 's/old_phrase/new_phrase/g'


Attention! The previous command finds files also in the hidden folders and if you’re working with Subversion or GIT you’d like to skip them. The following keys -not -path '*/\.*' makes the trick

find . -not -path '*/\.*' -type f -print0 | xargs -0 sed -i 's/http:\/\//https:\/\//g'


After this command your links like

<img src="http://example.com/dot.png">


will be converted to

<img src="https://example.com/dot.png">


Happy coding!