2
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

okyanet
  • 3,106
  • 1
  • 22
  • 16
Zecrow
  • 233
  • 3
  • 8

3 Answers3

12

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.

okyanet
  • 3,106
  • 1
  • 22
  • 16
1

Under the assumption that you own those pages.

    header("HTTP/1.1 404 Not Found");
    exit;
Naftali
  • 144,921
  • 39
  • 244
  • 303
  • @Zecrow well if you have those pages, then there. – Naftali Dec 18 '12 at 17:02
  • no i don't have those pages, they are just links to non-existent pages, but the server redirects them all to the main page, i need to make the server respond as 404 not found rather than 200 ok – Zecrow Dec 18 '12 at 17:06
  • 1
    No need to add headers and nothing wrong with the server. MODX handles 404s but in this case it hasn't been properly configured. – okyanet Dec 19 '12 at 13:35
0

it can be configured in System>system settings. search by key "error". put the value of your source 404.

suerte!

fdbazan
  • 39
  • 1
  • 7