Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure a 404 error page in MODX?

Tags:

php

modx

http://www.example.com/test1
http://www.example.com/test2
http://www.example.com/test3

all of these are non-existent pages and redirects to the index.php page, the search engines marks those links as duplicates, they return 200 ok, how to make them return 404 not found?

using modX cms

like image 613
Zecrow Avatar asked Jan 31 '26 15:01

Zecrow


2 Answers

By default, MODX serves up the home page when it can't find a page that matches the request if you haven't defined an error page.

Create a new resource to serve as your 404 page, then go to System > System Settings, search for error_page and add the ID of your error resource there.

MODX will then serve this resource for 'not found', automatically adding in the HTTP/1.1 404 Not Found header.

Note: I'm assuming you're using MODX Revolution, but it's very similar for Evolution.

like image 161
okyanet Avatar answered Feb 02 '26 06:02

okyanet


Under the assumption that you own those pages.

    header("HTTP/1.1 404 Not Found");
    exit;
like image 33
Naftali Avatar answered Feb 02 '26 07:02

Naftali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!