Web Island Agency

Jekyll & Netlify: Redirect issues and solutions

Jekyll & Netlify: Redirect issues and solutions
Jekyll & Netlify: Redirect issues and solutions

Netlify redirects have the same rules for Jekyll-powered websites generally. But there are some exceptions that might be confusing. Let’s take a closer look at common issues and solutions.

Netlify redirects don’t work

You added a _redirects file to your project folder, put redirection rules to the file, published to Netlify, but redirects still aren’t working? It’s probably, the most common issue for Jekyll websites hosted on Netlify. The reason for the issue is that Jekyll generator engine ignores files and folders starting with underscore by default, so the _redirects file isn’t getting to the _site folder after the build. A solution is simple: force Jekyll to proceed the file adding this few lines to _config.yml:

include:
  - _redirects

Trailing slashes

Netlify redirect rules are applied to URLs regardless of whether they contain a trailing slash. So setting trailing slash redirect manually in the _redirects file will cause a redirect loop. However, Jekyll allows to controll URL trailing slashes for each page. In the Front Matter of the page file find permalink property (create one if it’s not there). Here you can define URL for the page and use the URL format you like the most.

Join the discussion!

The article is published under the tags

Read more articles related to the topic