Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1
CHAPTER 15 ■ INTRODUCTION TO THE ZEND FRAMEWORK^217

./document_root
./document_root/images
./document_root/styles
./application
./application/models
./application/views
./application/views/scripts
./application/views/scripts/index
./application/controllers

Bootstrapping


Bootstrapping integrates your web server environment with the Zend Framework. It is where
the web server will send every request for your site, and it will handle application dispatching.
The first step is to create your index.php (bootstrap) file and .htaccess file in
document_root.

> cd document_root
> pico –w index.php

<?php
echo 'Rewrite working';

> pico –w .htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

■Note An .htaccess file is a file that controls the Apache web server. If you are not operating with
Apache, you will need to configure your server to send all requests to /index.php.

This script works by redirecting all requests that would have otherwise generated a 404
Not Found HTTP error to index.php. Technically, it checks if the request found a file, a symbolic
link, or a directory and redirects when those conditions are not met.

McArthur_819-9C15.fm Page 217 Thursday, February 28, 2008 7:44 AM

Free download pdf