How to reference/link to an online code repository, whose location may change in the future We are about to publish a paper in PLOS One Computational Biology about an algorithm that we developed. The code will be open-source on GitLab and we want include some obvious way of finding it.

It is suggested here that one should include the link to the code repository directly in the article (ideally the abstract). I think this makes a lot of sense.

However, I am a bit hesitant, because the location of the code might change in the future.

Are there any good ways to work around this? (such as e.g. redirection service, where I could update the URL; perhaps especially for academic work) 

Or is there another way of addressing this, such as revising the manuscript (like I said, it is PLOS One).
The first thing to check is whether your institution already has a policy for this. Mine for example maintains both a GitLab instance and a database of software written by research teams. We can use to the first for permanent links, since they are institutional. The second feeds directly into our annual reports.

If there is no policy, but there is an institutional Git service, then it is usually possible to create a repository specifically for your project (if your team doesn't already have one). I recommend creating a specific project, rather than mixing in with your personal project: it costs nothing more, and provides the best long-term stability. You can always update the README for the project or the repository to point to a different one, later on.

If there is neither, then you could create a specific project on gitlab.com (or equivalent). Same recommendation as above: create a specific project to contain the repository (again, unless your team already has one).

You mentioned PLoS Computational Biology so possibly there might be some experimental data or analytical output that you would like to provide. A Git service isn't appropriate for this, even with LFS, but an open archive like Zenodo is an excellent choice.

As a final note, if your project happens to be funded by the EU, then it should already have a data management policy.