Jquery中文网 www.jquerycn.cn
Jquery中文网 >  脚本编程  >  php  >  正文 zf中.htaccess的写法/http.conf的写法

zf中.htaccess的写法/http.conf的写法

发布时间:2015-01-20   编辑:www.jquerycn.cn
zf中.htaccess的写法/http.conf的写法

.htaccess的写法,在httpd.con中。
 

复制代码 代码如下:

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
php_value include_path "../lib"
#------------------------------
httpd.conf
RewriteEngine on
RewriteLog "g:\ZendFramework-0.1.2\rewrite.log"
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ /index.php

php_value include_path ".;g:\ZendFramework-0.1.2\library"
 

#------------------------------
httpd.conf中的实例:
 

复制代码 代码如下:

<VirtualHost 192.168.1.103:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html
ServerName linux
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost 192.168.1.103:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/ibm/www
ServerName ibm
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ /index.php
php_value include_path "../lib"

#这样子后ibm的域名中就可以用zendframework了
</VirtualHost>

参考教程

在存在多个PHP程序的主机上安装ZF的方法

这是我在我们PHPEye的Group上贴的,突然想到可能对大家有用就转过来了呵呵。

如果你的机子上已经有很多PHP项目,像我这样,绝大部份是不是基于ZF的。 我通常在WEB根目录下建立几十个目录,每个目录分别对应一个项目。原来我们访问项目可能是通过http://localhost/project1,http://localhost/project2这样进行访问。通常来说项目间不会互相影响,因为我们的程序一般不严格要求文件的路径。只要相对路径对就行了。

但是现在我们需要安装ZF,ZF要求index.php位于站点的根目录下。那么怎么使原来的程序仍然可以正常访问,而基于ZF的程序我们也可以访问?比如我建了个项目是happycms,那么我希望输入http://happycms就可以访问我的基于ZF的happycms项目,而其它项目仍然通过http://localhost/project1这样访问。

我的作法: 

1、编辑c:\windows\system32\drivers\etc目录下的hosts文件

127.0.0.1 localhost
下面加入:
127.0.0.1 happycms

2、编辑C:\Program Files\Apache
Group\Apache2\conf目录下的httpd.conf
加入 NameVirtualHost 127.0.0.1
在文件最末尾加上:
 

复制代码 代码如下:

<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot I:\Projects
RewriteEngine Off
</VirtualHost>

<VirtualHost 127.0.0.1>
ServerName happycms
DocumentRoot I:\Projects\happycms\svn\trunk\src\www
RewriteEngine On
RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg)$
RewriteRule ^(/.*)$ /index.php
</VirtualHost>

配置完成,无论是否基于ZF的项目都可以共存,互不影响。

您可能感兴趣的文章:
zf中.htaccess的写法/http.conf的写法
Zend Framework入门指引
学习apache的地址重写
php mvc使用htaccess隐藏index.php
zf框架Filter过滤器用法举例
让PHPnow支持wordpress静态化链接的方法
zf框架校验器InArray用法
PHP使用图片Etag判断用户的实例代码
修改php上传限制 修改phpmyadmin限制
htaccess文件为站点文件夹设置密码保护

关键词: zf框架   
[关闭]