Prev | Current Page 311 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


Correctly Signaling 404 and 500 Errors
It is important to use the correct HTTP status code when something special happens to the
visitor??™s request. You??™ve already seen that, when performing redirects, knowledge of HTTP status
codes can make an important difference to your search engine optimization efforts. This
time we will talk about 404 and 500.
The 404 status code is used to tell the visitor that he or she has requested a page that
doesn??™t exist on the destination web site. Browsers and web servers have templates that users
get when you make such a request??”you know, you??™ve seen them.
Hosting services let you specify a custom page to be displayed when such a 404 error occurs.
This is obviously beneficial for your site, as you can provide some custom feedback to your visitor
depending on what he or she was searching for. Sometimes, however, the 404 status code isn??™t
automatically set for you, so you need to do it in your 404 script. If, for some reason, your site
reacts to 404 errors by sending pages with the 200 OK status code, search engines will think that
you have many different URLs hosting the same content, and your site may get penalized.
The 500 status message is used to communicate that the web server or the application is
having internal errors. In the following exercise, we??™ll customize the TShirtShop to use the 404
and 500 status codes correctly.


Pages:
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
opony goodyear karta kredytowa millenium House Extension London zakłady bukmacherskie Potopek