Zend FrameWork Part-3


 

Zend FrameWork Part-3

In this tutorial we will study about Zend Framwork of PHP, Bootstrapping and different settings of .htaccess files are discussed in this topic. This is the third episode of the series subsequent pages will discuss on other and advance topic.

In this tutorial we will study about Zend Framwork of PHP, Bootstrapping and different settings of .htaccess files are discussed in this topic. This is the third episode of the series subsequent pages will discuss on other and advance topic.

Zend Framework (Part-3):

Bootstrapping:

Zend_Controller which is a Zend Framework's controller is built to support websites with clean URLs. To achieve clean URLs all requests should go through a single file called index.php( bootstrapper). This is like a central point for all pages of the application. All we have to do is create a file htaccess in the root directory (NewProject) and write the following code as follows:

 RewriteEngine on

RewriteRule .* index.php

php_flag magic_quotes_gpc off

php_flag register_globals off

The RewriteRule is simple and it is necessary for security reason. We also set a couple of PHP ini settings for security and sanity purpose. Requests for any script file like JavaScript etc., images, CSS files should not be accessible from the bootstrapper. To do this put all files under public subdirectory and configure Apache to serve these files directly with another .htaccess file in NewProject/public folder and write the following code in this file:

RewriteEngine off

To ensure that our application and library directories are protected, add the following folders and add contents in the file:

NewProject/application/.htaccess

deny from all

NewProject/library/.htaccess

deny from all

 

Note: .htaccess files are used by Apache, the configuration directive AllowOverride

must be set to All within your httpd.conf file.

Ads