编辑C:/WINDOWS/System32/drivers/etc/hosts文件,增加一个域,如
127.0.0.1 audit.local
修改apache的configure文件,在xampp环境下就是在d:/xampp/apache/conf目录下,首先编辑httpd.conf,开启rewrite模块:将这行的注释去掉:
#LoadModule rewrite_module modules/mod_rewrite.so
把#号去掉,变成:
LoadModule rewrite_module modules/mod_rewrite.so
然后编辑extra/http-vhosts.conf文件,增加如下行:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
ErrorLog logs/localhost.error_log
CustomLog logs/localhost.access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/xampp/audit/public/"
ServerName audit.local
ErrorLog logs/audit.error_log
CustomLog logs/audit.access_log common
RewriteEngine off
<Location />
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !.(js|ico|gif|jpg|jpeg|pdf|png|css)$ /index.php
</Location>
<directory "D:/xampp/audit/public">
#Allow server side include,cgi, disable directory index
Options FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</directory>
</VirtualHost>
重新启动apache,就可以开始使用了更多关于apache rewrite rule的写法和说明。
如果在nginx服务器上,参考nginx下的zend framework的设置
下载zend framework并安装到php/lib目录下
建立项目的文件目录,你可以用最基本的zend framework quick start中推荐的结构,也可以直接使用我们项目使用的ZF1.6标准目录结构。
此文发布时ZF的版本为1.6.1