-
-
Notifications
You must be signed in to change notification settings - Fork 35
How to make a redirect
Here’s an example redirect file: https://github.com/foodoasisla/site/blob/master/prototype.md
You can try it out by visiting this URL: https://foodoasis.la/prototype/
Here are some steps you can follow to make a new redirect…
-
Create a new file with a name that matches the URL you want to redirect from. For example, a file named
food.md
could act as a redirect forfoodoasis.la/food
. You can place this file at the root of the website. -
Copy and paste this example code into your new file:
---
layout: default
title: Redirecting to Example Location
redirect: https://example.com
---
# Redirecting to Example Location…
[https://example.com](https://example.com)
-
Change the “redirect” URL to the place where you want to redirect to.
-
Update the page title and content with information about the redirect.
Since the website is hosted on GitHub, redirects are done on the client side. When the site is generated, the “redirect” URL is translated into a refresh element…
<meta http-equiv="refresh" content="0; url=https://example.com" />
The title and content of the page are helpful to search engines and also provide a fallback for users–just in case the meta element doesn’t work.