Cakephp 中的 Wordpress [英] Wordpress inside Cakephp

查看:16
本文介绍了Cakephp 中的 Wordpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Cakephp 的 /app/webroot/blog/ 文件夹中安装了 Wordpress,并将 wordpress 永久链接设置更改为月份和名称(例如 http://abc.com/blog/2013/02/sample-post/).

I have installed Wordpress inside Cakephp's /app/webroot/blog/ folder and changed the wordpress permalink settings to Month and name (eg. http://abc.com/blog/2013/02/sample-post/).

现在,当我查看帖子时,我发现缺少控制器(错误:找不到 BlogController).

Now when i am viewing a post i am getting Missing Controller(Error: BlogController could not be found).

我想更改 cakephp 路由,以便任何带有 /blog/* 的内容都将指向 webroot 博客文件夹.

I want to change the cakephp routes so that anything with /blog/* will point to webroot blog folder.

有人可以帮我吗?

推荐答案

当我们更改 Wordpress 的永久链接设置时,它会生成一个 .htaccess 文件,如果需要权限,否则我们必须创建它.

When we change the permalink settings of Wordpress, it generates a .htaccess file, if there is required permission else we have to create it.

在上述情况下,/blog/ 文件夹中没有 .htaccess 文件.我在更改永久链接设置时使用 Wordpress 提供的以下 mod_rewrite 规则创建了它.

In the above case there was no .htaccess file inside /blog/ folder. I created it with the following mod_rewrite rules as provided by Wordpress while changing permalink settings.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /blog/
  RewriteRule ^index.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /blog/index.php [L]
</IfModule>

此后一切正常.

这篇关于Cakephp 中的 Wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆