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.
</