Here is how you can get 404 headers to be sent. This is from the archives, so I'll post it here.
Well first off the issue is really due to the fact that Zen Cart does not send 404 headers. If you turn SEO off or on a shop with it turned off, and you can go to index.php?main_page=gobbledeygook, you will get an HTTP 200 OK header (and most likely the index page). It's just that the issue is a bit more noticeable with SEO installed, but it exists in a plain vanilla Zen Cart install as well.
You can send 404 headers on invalid pages by doing this (for 1.3):
- Open file includes/init_includes/init_sanitize.php
- Find on line 105 or thereabout:
PHP Code:
if (!is_dir(DIR_WS_MODULES . 'pages/' . $_GET['main_page'])) {
- Add after:
PHP Code:
header('HTTP/1.1 404 Not Found');
That will give a 404 header to user agents (including search bots) on invalid pages.
Bookmarks