If you host a website, it is worth considering using the secure
HTTPS encryption instead of
HTTP (also in light of the GDPR).1 As someone who is less experienced in setting this up, this can be challenging, particularly if you use a domain that you do not personally own. This post is meant to give a (really) short step-by-step guide for those in a similar situation.
I build my homepage using the wonderful
blogdown package with a customized version of the Hugo Academic theme. To deploy the website, I rely on Netlify, which works like a charm! Since I did not want the default
netlify.app domain (suffix) to be my domain, I oppened an issue to request the
rbind.io suffix. Setting this up is extremely straightforward and well explained here. Well, now that this worked, I wanted to be able to use
HTTPS instead of
HTTP. And here, the challenge began.
The solution 💡
In retrospect, it was all nicely explained in the answer to my issue, which I was not aware of back then. I hope this post will pop up for future users and point them quickly to the solution.
The excellent description by Yihui Xie describes everything what you need to do (and to know). Here is what I did using my own words:
- Open your website
- Open a new plain
- Copy the following line and replace the word
domainso that it matches your website name (for me, it would be
http://domain.rbind.io/* https://domain.rbind.io/:splat 301!
- Save the file as
_redirects(no suffix needed) in the
staticfolder of your website. This is how the (simplified) root overview of your folder should look like:
├── R ├── README.md ├── assets ├── config ├── config.toml ├── content │ ├── about │ ├── authors │ ├── courses │ ├── home │ ├── post │ ├── project │ ├── publication │ ├── slides │ └── talk ├── index.Rmd ├── libs ├── Your-website.Rproj ├── netlify.toml ├── public ├── resources ├── static │ └── _redirects └── themes
You’ll see that
_redirects is located directly in the
Well, and that’s it – this little trick did the magic for me! 🪄