Custom 404
When you run Jekyll on Azure PaaS, you will notice that the 404.html
error page supplied by the Jekyll generator will not be hit.
Azure Static Web Apps
To enable custom 404 on Azure Static Web Apps, you can add a staticwebapp.config.json
to your site:
{
"responseOverrides": {
"404": {
"rewrite": "/404.html"
}
}
}
This will show your 404.html
page on a not found.
Ref.: Configure Azure Static Web Apps
App Service (Windows)
To enable custom 404 on Azure Web Apps, you can add a Web.config
(yes the old ASP.NET one) to your site:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
This will show your 404.html
page on a not found.