Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-7782

Send HTTP 404 if topic, forum or user do not exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.0.8-RC1
    • 3.0.x
    • Viewing posts
    • None
    • PHP Environment:
      Database:

      Currently phpBB shows a "Topic doesn't exist" message when the user tries to open an invalid URL, the URL of a deleted topic or the URL of a topic that's inaccessible to this user. The same goes for forums.

      For bots it would be good if a 404 is returned in these cases because:

      • This makes it easier to erase unwanted information from search engine caches/indices
      • Some bots don't like the fact that random URLs return a 200 statuscode
      • The bot won't need to update the URL (as often) as it would when a 200 is returned
      • It's not very useful to index a "Topic doesn't exist" page

      I've fixed this by adding this around the topic of msg_handler():

              if ($msg_text == 'NO_TOPIC' || $msg_text == 'NO_FORUM')
              {
                      header("HTTP/1.0 404 Not Found");
              }
      

      IMO this is not the cleanest way to fixed this but this saved me quite a bit of work Those two messages are returned in quite a few places...

            naderman Nils Adermann
            BartVB BartVB [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: