404.tpl gives HTTP 200 OK, although header('404')
  • Hi,

    I want to ensure the 404.tpl Pages being sent to Browser with corrent HTTP Error Code.
    Therefore I did following:

    //file: 404.tpl//

    {{ include file="_tpl/_html-head404.tpl" }}
    <body id="sectionpage">
      <div id="container">
    ...

    //file tpl__html-head404.tpl //

    {{php}}
    header('HTTP/1.0 404 Not Found');
    {{/php}}
    {{ include file="_tpl/_html-head.tpl" }}

    But when performing a wget -S there a HTTP 200 is given instead of a HTTP 404.

     wget -S http://x253.rz14.tiri.li/xxxx -O - 2>&1

    --2012-07-09 20:49:23--  http://www.tiri.li/xxxx
    Resolving www.tiri.li (www.tiri.li)... 127.0.1.1
    Connecting to www.tiri.li (www.tiri.li)|127.0.1.1|:80... connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Date: Mon, 09 Jul 2012 18:49:23 GMT
      Server: Apache/2.2.22 (Ubuntu)
      X-Powered-By: PHP/5.3.10-1ubuntu3.2
      Set-Cookie: PHPSESSID=kr0p5e7q4l353gh8g80k4t9i90; path=/
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Cache-Control: public, max-age=3600
      Pragma: cache
      Vary: Accept-Encoding
      Keep-Alive: timeout=5, max=100
      Connection: Keep-Alive
      Transfer-Encoding: chunked
      Content-Type: text/html; charset=utf-8
    Length: unspecified [text/html]
    Saving to: `STDOUT'

    <!doctype html>
    ....

    How should the template file being modified to send correct header(...) Codes ?
  • 1 Comment sorted by
  • hi,

    i've made a plugin for 4.0.2. described in wiki

    if you want to use it in your current version, download attached file in include/smarty/campsite_plugins folder.

    petr
    Post edited by Petr Jasek at 2012-07-11 04:06:09