在子目录中设置 CakePHP;Wordpress 安装在根目录下 [英] Set up CakePHP in a subdirectory; Wordpress is installed in the root
问题描述
我已经寻找了 2 个小时的解决方案,但似乎没有任何效果...这是我的问题:
I have been searching for a solution for 2 hours but nothing seems to work... here is my problem:
我在根目录 (var/www) 中安装了 WordPress.因此,通过访问 http://www.geekderek.com,我可以看到我的 wordpress 网站.
I have WordPress installed in the root (var/www). So by going to http://www.geekderek.com, I see my wordpress site.
我将 CakePHP 放在子目录 var/www/cakephp 中.我希望能够通过以下方式查看我的 CakePHP 应用程序:www.geekderek.com/cakephp.
I put CakePHP in a subdirectory var/www/cakephp. I want to be able to see my CakePHP app by going to: www.geekderek.com/cakephp.
但是,目前这个 url 只返回一个 Wordpress 页面,上面写着找不到内容."
However, currently this url just returns a Wordpress page saying "Content not found."
我相信这个问题可以通过修改我的根目录中的 .htaccess 来解决.所以这是我的 .htaccess:http://pastebin.com/sXJTRstB
I believe this problem can be solved by modifying .htaccess in my root directory. So here is my .htaccess: http://pastebin.com/sXJTRstB
如您所见,我将此行添加到默认的 WP .htaccess 文件中:
As you can see, I added this line to the default WP .htaccess file:
RewriteRule ^cakephp(/(.*))?$ cakephp/app/webroot/$1 [QSA,L]
但是,由于某种原因,这似乎不起作用.
However, for some reason this doesn't seem to work.
谁能告诉我怎么了??非常感谢!
Could anyone please tell me what is wrong?? Thank you so much!
推荐答案
我有类似的设置,我的蛋糕应用程序在子目录中,我的根 .htaccess 有这个重写规则:
I have simmilar setup, that my cake app is in subdirectory, my root .htaccess has this rewrite rule:
RewriteRule ^cakephp/(.*)$ /cakephp/$1 [L,QSA]
其余的都是通过常规的 cakephp 设置来处理的.
All the rest is handled with the regular cakephp setup.
我的/cakephp/app/webroot/.htaccess:
my /cakephp/app/webroot/.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
希望这对你也有用:)
这篇关于在子目录中设置 CakePHP;Wordpress 安装在根目录下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!