ZF-developed methods for integrating PHP applications with traditional PHP applications

Source: Internet
Author: User
Tags rar



ZF-developed methods for integrating PHP applications with traditional PHP applications

As you know, ZF needs to have all HTTP requests processed by index.php (bootstrap), so we need to configure the URL rewrite rules for the server, such as Apache httpd.conf:

Rewriteengine on
Rewritecond%{request_uri}!^.* (. css|. js|. html|. Zf|. Gif|. Pdf|. rar|. Ppt|. Chm|. Png|. Jpg|. JPEG) $
Rewriterule ^ (/.*) $/index.php

We turned the request for all files except for a specific extension to index.php.

But there's a problem: what if I want to put an existing PHP program in a Web site? Requests to the program are also turned to index.php, and obviously the program is not working properly.

By modifying the URL rewrite rules, we can solve this problem.

such as installing discuz! Forum, we put it in the/bbs directory, then we can rewrite the rewrite rules like this:
Rewriteengine on
Rewritecond%{request_uri}!^.* (. css|. js|. html|. Zf|. Gif|. Pdf|. rar|. Ppt|. Chm|. Png|. Jpg|. JPEG) $|. * (BBS). *
Rewriterule ^ (/.*) $/index.php

Notice that we added a | At the end. * (BBS). *, that is, if the request appears in the BBS words will not turn to index.php, so that we can access
All files under the BBS directory will not turn to/index.php.

With this approach, you can easily integrate ZF-developed programs with traditional PHP programs.


</

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.