Prev | Current Page 317 | Next

Emilian Balanescu and Cristian Darie

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

php and 500.php files.
5. Load http://localhost/tshirtshop/seasonal-d3/page-5/. Because the Seasonal department
has only four pages of products, TShirtShop should throw the 404 page as shown in Figure 7-8.
Figure 7-8. Testing the 404 page in TShirtShop
CHAPTER 7 ?–  SEARCH ENGINE OPTIMIZATION 219
How It Works: 404 and 500
In this exercise, and in the previous one, you??™ve learned how to work with the 404 and 500 status codes using the
.htaccess configuration file and with PHP code. For 404, the usefulness of both techniques is more obvious. If
the user requests a page that doesn??™t match any existing location of your web site, Apache will use the 404 page
that you configured in .htaccess. However, if the user requests a technically valid page but one whose contents
don??™t exist, such as category subpage whose Page value is larger than the largest existing page, we need to throw
the 404 page ourselves using PHP code. To test the first scenario, just load a page such as http://localhost/
tshirtshop/does_not_exist.php. The second scenario was tested in the last step of the exercise, and the
output is shown in Figure 7-8.
Summary
We??™re certain you??™ve enjoyed this chapter! With only a few changes in its code, TShirtShop is
now ready to face its online competition, with a solid search-engine-optimized foundation. Of
course, the search engine optimization efforts don??™t end here.


Pages:
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
detektyw gdańsk agencja detektywistyczna Pozycjonowanie doradztwo inwestycyjne włosy