Help with 404s not directing to pages set by error_page


I have a 2.8.4 MODX site using Xrouting to handle contexts as folders and SEOSuite to manage redirects. This is on a new redesigned site, people are attempting to use old urls for the previous site.

I am having trouble with some 404s returning the following message:

Page not found

The page you requested was not found.

Instead of directing to the correct 404 page for the context (each context has a error_page setting). I have been able to use SEOSuite for 301 redirects for the most important pages. But I want the 404s to use the correct pages which offers search and has information about the old and new site.


Maybe there is another extra that interferes with the standard behavior of MODX.

Are there any other plugins that run on the event “OnPageNotFound”? Under manager/?a=system/settings there is a tab “System Events” to check that.

You could temporarily disable these plugins to see which one prevents the error_page setting from being applied.

It’s also possible the web server is returning the 404 without ever routing it to MODX. Check your friendly URL configuration.

The SeoSuite is run on the event “OnPageNotFound”. I disabled the plugin, flushed permissions and cleared cache, but I am still getting the page not found page instead of the correct error page.

I have Friendly URLs enabled and all seems to be working correctly

This message should only appear if there is neither a setting for error_page nor one for site_start.

Maybe you could do some “debugging” to find out what is going wrong.

For example by (temporarily) adding an error log statement like this

$this->log(modX::LOG_LEVEL_ERROR, 'error_page is ' . $this->getOption('error_page', $options));

in the “sendErrorPage” function before this line

Then checking the MODX error log to see if this function gets executed and what the value of error_page actually is.

1 Like

@halftrainedharry Thank you so much.

I found that all my contexts settings were correct but the main system settings error_page was set to a page I had marked as deleted. I had created a new error page for 404s. I always use resource ID 404 for my 404s.(as a joke) It was still pointing to resource ID 214 which I had deleted.

You are an amazing asset for the MODX community, I learn so much all the times I read your posts to my and others issues. Great Job



This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.