How to do redirects on Netlify
Redirection is a process of forwarding users from one URL to another. Netlify provides a simple and straightforward way to set redirects for your website. Netlify redirects are definable in a _redirects file added to your website folder.
There is nothing difficult about redirects definition. To set up a basic redirection write source URL and target URL in one row. Examples of basic redirects are listed below:
If you begin a line with # it will be recognized by the Netlify redirects engine as a comment. The redirect engine parses rules from top to bottom and triggers on the first matching rule.
The default HTTP status code is 301. If you need to take control of it, just put the status code as a third value in the rule row. For example:
If you assign 301, 302 or 303 status code to redirect rule, Netlify will redirect to the destination URL. Any other code will force Netlify to return the target document with the specified status code. Specifying 200 as a status code, Netlify will work just like a regular proxy with some security restrictions.
In the next article I'll cover setting up Netlify redirects for Jekyll website, common issues and their solutions.