我正在尝试在CakePHP 3中安装Wordpress。我已经关注this,但它无效。两个问题:
domain.com/wordpress/
,我会陷入same issue:500 internal server error
domain.com/wordpress
(没有尾随斜杠),它会像cakePHP请求一样处理,我得到Error: WordpressController could not be found
我也尝试过基岩,WP的修改版本。但没有运气。
文件夹结构(带原始WP):
www/
├─── cake/
│ ├─── webroot/
│ │ └── .htaccess
│ ├─── wordpress/
│ │ └── .htaccess
│ └── .htaccess
└── .htaccess
各种htaccess
个文件:
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 /饼/ htaccess的
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cake/
RewriteRule (.*) webroot/$1 [L]
</IfModule>
WWW /饼/根目录/ 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 /饼/ 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已设置为debug。
答案 0 :(得分:1)
您的 www / cake / wordpress / .htaccess 应为:
<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>
修改
好的,这就是问题所在。 http://example.com/ 指向 www / 目录。并且您希望 http://example.com/wordpress/ 指向 www / cake / wordpress 。您需要删除 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>