2014-03-24 29 views
0

我在CakePHP的app/webroot/blog文件夹中安装了wordpress安装程序,通常访问我的www.example.com/blog/,但是当我进入一篇文章我失去了链接,例如我得到www.example.com/blog/app/webroot/blog/?p=1在CakePHP的我的app/webroot/blog文件夹中安装Wordpress

有没有解决方案来解决这个问题?我想我应该修改我的wordpress .htaccess,但我不知道要添加什么。

我的WordPress .htaccess文件是:

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

我CakePHP的应用程序/的.htaccess是

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ webroot/ [L] 
    RewriteRule (.*) webroot/$1 [L] 
</IfModule> 

我的CakePHP的应用程序/ Web根目录/的.htaccess是

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

干杯

+0

这[blog](http://www.balistupa.com/blog/2010/08/how-to-redirect-appwebrootblog-into-blog-wordpress-cakephp/)可以帮助你。 – Rikesh

回答

2

我的方式d是将wordpress文件夹放在根目录中,并将其命名为/ blog。

请注意,这是不会到蛋糕的根目录文件夹,它只是把文件夹中的实际的根,沿着/应用程序,/ lib下,/插件等,

然后我修改根目录的.htaccess文件看起来像这样:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase/

    # Disable rewriting for the wordpress blog 
    RewriteCond %{REQUEST_URI} ^/blog/ [NC] 
    RewriteRule (.*) $1 [L] 

    # Normal CakePHP rewriting 
    RewriteRule ^$ app/webroot/ [L] 
    RewriteRule (.*) app/webroot/$1 [L] 
</IfModule> 

这似乎是将网站的蛋糕部分与wordpress部分完全分开的最佳方式。

它适用于我。

相关问题