Zend 框架和 Wordpress 集成

2023-05-30php开发问题
1

本文介绍了Zend 框架和 Wordpress 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我们在 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?

这篇关于Zend 框架和 Wordpress 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17