Converting HTTP to HTTPS

all about tech.
Post Reply
george
Site Admin
Posts: 16
Joined: Thu Aug 01, 2019 3:16 am
Converting HTTP to HTTPS

Post by george » Wed Sep 09, 2020 4:44 pm

1) If you are hosting your own webserver, you will want to use https://certbot.eff.org/. You will need to select your web server software, and your operating system. Then you will need to install certbot which will automatically generate you a free SSL certificate for HTTPS use and change your .htaccess configuration to reflect on the HTTPS changes.

2) You will then need to forward port 443 to the internal IP address of your server using the TCP protocol (quite like how your HTTP port forward is set up on port 80). This will allow secure connections on that port.

3) Now you will need to go into your web root directory (usually /var/www) or (var/www/public_html) and go through each and every one of the files on your website. You are going to ensure that any non-relative links (like http://www.example.com/dir) are changed to https://www.example.com/dir. This could take a while. The alternative to doing this is to just ensure that all links are relative (so instead of http://www.example.com/dir the link would just read /dir). If you are trying to create a link that must go back a directory, use: ../ (example: ../index.html). There are tools and terminal command lines that can do this for you. You can use sed -i for example, but this method would require you to create a backup first and also won't account for pages that are still using http. More info on that here.

4) That's it. You should not have a fully functional, https web server that will automatically update the certificates as they expire.

If at any point you want to revert to the old http configuration, you can do so with the use of one command:

Code: Select all

certbot --WebServiceSoftware rollback
where --WebServiceSoftware is the name of your web software (I.E.: apache or nginx).


Post Reply