Codeigniter & PHP - forcing a 404?

后端 未结 8 1353
予麋鹿
予麋鹿 2020-12-08 10:19

In codeigniter, as you know, a page of the form: /class/function/ID, where class is the controller name, function is the method within the controller, and ID is

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 10:53

    show_404() actually sends the proper headers for a search engine to register it as a 404 page (it sends 404 status).

    Use a Firefox addon to check the headers received when calling show_404(). You will see it sends the proper HTTP Status Code.

    Check the default application/errors/error_404.php. The first line is:

    
    

    That line sets the HTTP Status as 404. It's all you need for the search engine to read your page as a 404 page.

提交回复
热议问题