How to write .htaccess/how to write http.conf in zf

WBOY
Release: 2016-07-25 09:10:26
Original
808 people have browsed it
  1. RewriteEngine on

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

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

复制代码

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

  1. ServerAdmin webmaster@dummy-host.example.com
  2. DocumentRoot /var/www/html
  3. ServerName linux
  4. ErrorLog logs/dummy-host.example.com-error_log
  5. CustomLog logs/dummy-host.example.com-access_log common
  6. ServerAdmin webmaster@dummy-host.example.com
  7. DocumentRoot /var/www/html/ibm/www
  8. ServerName ibm
  9. ErrorLog logs/dummy-host.example.com-error_log
  10. CustomLog logs/dummy-host.example.com-access_log common
  11. RewriteEngine on
  12. RewriteRule !.(js|ico|gif|jpg|png|css|php)$ /index.php
  13. php_value include_path "../lib"

  14. #这样子后ibm的域名中就可以用zendframework了

复制代码

参考教程

在存在多个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:windowssystem32driversetc目录下的hosts文件 在 127.0.0.1 localhost 下面加入: 127.0.0.1 happycms

2、编辑C:Program FilesApache GroupApache2conf目录下的httpd.conf 加入 NameVirtualHost 127.0.0.1 在文件最末尾加上:

  1. ServerName localhost
  2. DocumentRoot I:Projects
  3. RewriteEngine Off
  4. ServerName happycms
  5. DocumentRoot I:Projectshappycmssvntrunksrcwww
  6. RewriteEngine On
  7. RewriteCond %{REQUEST_URI} !^.*(.css|.js|.gif|.png|.jpg|.jpeg)$
  8. RewriteRule ^(/.*)$ /index.php
复制代码

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



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!