Skip to main content
6 votes
Accepted

Craft not loading custom 404 template for errors

Turns out the general.php file had the following line (docs) in it: 'errorTemplatePrefix' => "_errors/" Once I'd created the proper folder and files, all worked as expected. Thanks, @CraftCMS ...
Sandwich's user avatar
  • 636
5 votes

Craft not loading custom 404 template for errors

It's quite possible that you are in Dev mode. If you switch to false, the 404.html may then be recognized… Look at general.php, then change devMode to false. // Dev environment settings 'dev' =&...
TRIM's user avatar
  • 314
4 votes
Accepted

How to show homepage for 404 errors

404 isn’t a valid redirect status code, which is why {% redirect '/' 404 %} isn’t working correctly. It sounds like you want to: first issue a 301 or 302 redirect to the homepage then serve the ...
Brandon Kelly's user avatar
4 votes
Accepted

How to route 404 errors for multi-site Craft?

I pondered this for a while, and then did this, which will direct us to specific entries (not templates, I don't want to create more of those): {# We need a unique 404 for each site - just take us to ...
4midori's user avatar
  • 666
3 votes

404 problems, staging only

Looking at your screenshots, the host names are different. The cPanel 404 shows mysphotos instead of myphotos. Probably a typo somewhere in your templates.
Mike Pringle's user avatar
3 votes

devMode false, Internal Server Error

Cleared the log files found at /storage/logs/web.log. Tried to view an inner page on the website which threw a Craft "Internal Server Error". Inside the log, I saw "Twig\Error\SyntaxError: Unknown "...
BrianMc's user avatar
  • 71
3 votes
Accepted

404 page title SEOmatic

So it looks like you're using the old syntax for SEOmatic 1.x for Craft 2.x; here's how you do the same thing in SEOmatic for Craft 3: {% do seomatic.meta.seoTitle("Some Title") %} c.f.: https://...
andrew.welch's user avatar
  • 11.6k
2 votes
Accepted

404 error page not loading

So my issue was very simple to solve once I paid better attention. The 404 was loading perfectly fine the whole time, my problem was that in my 404 file I had it as {% block content %} and not {% ...
Darryl Hardin's user avatar
2 votes

Craft not loading custom 404 template for errors

Make sure you are in production mode in the .env file: ENVIRONMENT=production Make sure you have developer mode disabled in config/general.php file: 'devMode'=>false Make sure you have a 404.twig ...
Alexis Dalai Waldo Jiménez's user avatar
2 votes
Accepted

404 problems, staging only

Probably your paths are not set up right; or the SERVER_NAME isn't what you think it is, so it's not matching the paths in your general.php
andrew.welch's user avatar
  • 11.6k
2 votes

Template not found: $PRIMARY_SITE_URL/$PRIMARY_SITE_URL/blog/this-is-my-blog

You have to go to your Admin Dashboard > Settings > Sites > Your site and delete Base URL field, then save it and try to navigate.
Alexis Dalai Waldo Jiménez's user avatar
1 vote

Craft CMS shows disabled entry page

Try adding this to the beginning of your case study entry template: {% if entry is not defined %} {% exit 404 %} {% endif %} Do you have a route set up for your case studies? I've got routing ...
SamC's user avatar
  • 482
1 vote

Can I define a path to my 404 template?

Here's more than you ever wanted to know on 404 and error templates in Craft CMS: Handling Errors Gracefully in Craft CMS
andrew.welch's user avatar
  • 11.6k
1 vote

What's the best way to set up a content-manageable 404 page?

This is something I discuss in the Handling Errors Gracefully in Craft CMS article, not just for 404s, but for a number of different status codes/errors. The actual templating code then ends up ...
andrew.welch's user avatar
  • 11.6k

Only top scored, non community-wiki answers of a minimum length are eligible