Zend 框架和 Wordpress 集成

2021-12-29 00:00:00 php wordpress zend-framework .htaccess

我们在 ourdomain.com 上有一个现有的 Zend Framework 站点,在 blog.ourdomain.com 上有一个 wordpress 博客

We have an existing Zend Framework site hosted at ourdomain.com and a wordpress blog at blog.ourdomain.com

我们想将博客迁移到位于 ourdomain.com/blog 的站点中 - 但我似乎已经用谷歌搜索到了地球的尽头,无法找到方法.我尝试了各种 .htaccess 的东西,设置了一个博客控制器并包括一些 wordpress 文件等 - 但无济于事.

We want to migrate the blog into the site at ourdomain.com/blog - but I seemed to have googled to the end of the earth and cannot find out how. I have tried various .htaccess stuff, setting up a blog controller and including some wordpress files, etc - but to no avail.

有人有什么想法吗?

虚拟主机设置:

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/bradyeager/Sites/TWPZend/public"
ServerName twps
ErrorLog "logs/twps-error-log"
CustomLog "logs/twps-access_log" common

期权索引 FollowSymLinks

Options Indexes FollowSymLinks

AllowOverride All

Order allow,deny
Allow from all

推荐答案

最有效和最简单的方法是通过修改 .htaccess 文件而不将任何以 /blog 开头的内容发送到ZF 应用程序——只需将其传递给 Wordpress.Wordpress 必须安装在您的文档根目录中,当然,要使其正常工作,这与您通常的安装方式完全相同.

The most efficient and easiest way to accomplish this by modifying your .htaccess file to NOT send anything that starts with /blog to the ZF app -- just pass it through to Wordpress. Wordpress would have to be installed inside your document root, of course, for this to work, exactly how you would normally install it.

示例:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^blog - [NC,L]

RewriteRule ^.*$ index.php [NC,L]

关于在您的 ZF 应用程序中创建自定义控制器、动作和路由,然后通过您的应用程序传递到 Wordpress 的所有这些废话绝对是荒谬的.您会执行应用程序引擎的完整调度周期,只是为了转发到另一个应用程序?

All this nonsense about creating custom controllers, actions and routes in your ZF app, then passing off to Wordpress via your app is absolutely ridiculous. You'd be executing a full dispatch cycle of your application's engine, just to forward off to another app?

相关文章