rlcabral
rlcabral

Reputation: 1546

Installing Wordpress inside CakePHP 3

I'm trying to have Wordpress inside CakePHP 3. I have followed this, but it is not working. Two problems:

I have also tried with bedrock, a modified version of WP. But no luck.

The folder structure (with original WP):

www/
├─── cake/
│   ├─── webroot/
│   │    └── .htaccess
│   ├─── wordpress/
│   │    └── .htaccess
│   └── .htaccess
└── .htaccess

And the various htaccess files:

www/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule (wordpress/.*) $1 [L] # adjust the regex to what you want.
    RewriteRule    ^$ cake/webroot/    [L]
    RewriteRule    (.*) cake/webroot/$1 [L]
</IfModule>

www/cake/.htaccess

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

www/cake/webroot/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /cake/webroot/

    RewriteCond %{THE_REQUEST} \s/+cake/webroot/([^\s&]*) [NC]
    RewriteRule ^ /%1 [R=302,L]

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

www/cake/wordpress/.htaccess

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

/var/log/error.log

[core:error] [pid 5506] [client xxx.xxx.xxx.xxx:55118] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

*LogLevel is already set to debug.

Upvotes: 0

Views: 800

Answers (1)

Eduardo Escobar
Eduardo Escobar

Reputation: 3389

Your www/cake/wordpress/.htaccess should be:

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

Edit

Ok, here's the problem. http://example.com/ points to www/ directory. And you want http://example.com/wordpress/ to point to www/cake/wordpress. You'll need to adequeate www/.htaccess:

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

Upvotes: 1

Related Questions