Zend Framework Intro: Creating Apache .htaccess



Zend Framework Step By Step Tutorial - Part 4: We need route any requests to the front controller. We can use module from apache named "mod_rewrite". About this module, you can read at this post. Then, we will work with .htaccess file. This file will do routing job.

Create a file named ".htaccess" within web_root. Then enter following code:

RewriteEngine On
RewriteRule .* index.php

At the line 2, we can see, Apache will route all request to index.php. Simple code, isn't it?

Another option, you can configure it directly in Apache's httpd.conf file. We know, it is not easy way if we don't have own server. Thus, configure in a local Apache configuration file named .htaccess is better option.



Series this article:
Zend Framework Intro: Folder Structure
Zend Framework Intro: Explaining Anatomy of Zend Framework Application
Zend Framework Intro: Creating Index.php as Single Access File
Zend Framework Intro: Creating Apache .htaccess
Zend Framework Intro: Creating Controller
Zend Framework Intro: Creating View


Tag: framework, zend, zend framework, htaccess, mod_rewrite, apache Category: PHP Framework Post : April 08th 2008 Read: 9,134 Bookmark and Share

blog comments powered by Disqus