开发者

Zend Framework site with Drupal (or any other CMS) in subfolder)

I'm building web site/application based on Zend Framework. For large number of pages I want to use Drupal. Dru开发者_运维问答pal is presumably installed in /cms folder.

Zend Framework entry point is

/public/index.php

And for Drupal is

/public/cms/index.php

How can it be done with some .htaccess mod_rewrite rules to remove "/cms/" part for URL for Drupal, that is, I want link to page to be

www.example.com/blog/a-blog-post

instead of

www.example.com/cms/blog/a-blog-post

Also, I want my custom Routes from Zend Framework to work properly.

Subquestion: Who will serve 404 not-found page, Zend Framework app or Drupal ?


Not sure how Drupal handles it's root hostname, but using the default mod_rewrite rules in Zend Framework, anything in the public path that exists as a folder will override the ZF routes.

So I'm guessing if you install Drupal in public/blog you could path out to www.example.com/blog/a-post-name and it would hit Drupal. At least that's what I do when using Wordpress in conjunction with ZF.

Error pages would be rendered depending on which application is running when the error is encountered.


As long as your drupal urls are all '/blog' a single rewrite rule for that should suffice as long as it is interpreted before zend frameworks rewrite rules.

I'm just pulling this from the top of my head, so I hope it works:

RewriteEngine On
RewriteBase /blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

The important [L] tells apache it's the last rule and shouldn't go further. This should work but it might need some massaging.;)

To answer your subquestion, the 404 will be tossed by both. Anything not found in /blog will be drupal, anything else not found will be ZF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜