J How to set a redirect

J.1 Non GitHub pages site (e.g. Netlify)

Replace the content of the current website with

<meta http-equiv="refresh" content="0;URL=https://docs.ropensci.org/<pkgname>/" />  
<script language="javascript">
  window.location.href = "https://docs.ropensci.org/<pkgname>"

J.2 GitHub pages

You can setup the redirect from your main user gh-pages repository:

  • create a new repository (if you don’t have one yet): https://github.com/<username>/<username>.github.io
  • In this repository create a directory <pkgname> containing the file index.html that redirects to the new location (see previous subsection)
  • Test that https://.github.io//index.html now redirects
  • Optional: you could even create a 404.html file in your <username>.github.io repo to redirect arbitrary pages.