CakePHP and existing codebase living peacefully side-by-side
I've got two legacy codebases that I would like to have living side by side. One is Cake, one is handwritten PHP.
I would like both to be located at www.example.com. I'd like the handwritten PHP to serve any requests in the root directory, but anything else I'd like to go to the cake codebase. I cannot simply put cake in a subdir, because all of the links generated by the cake app are hardcode开发者_如何学God to be from the root of the site. So Cake won't work in a separate subdomain.
I'd like to do this because I want to share an SSL cert between the two codebases, so I can't put it on a subdomain (wildcard certs are too pricey).
Any advice?
CakePHP boot (index.php
) is only invoked when Apache can't find a specific file/directory. Because of this, you can install a your non-cake php files in the document root as normal and they will be ignored by cake.
One modification to be made is renaming cake's index.php
to something like, cake-index.php
. Then in the .htaccess change rewrite rule to match:
RewriteRule ^(.*)$ cake-index.php?url=$1 [QSA,L]
精彩评论