简体   繁体   English

Wordpress多站点子目录重定向无限循环问题

[英]Wordpress multisite subdirectory redirect infinite loop issue

Any time I create a new site on my multisite install, I get an infinite loop redirect when navigating to that site's admin. 每当我在多站点安装上创建新站点时,在导航到该站点的管理员时,我都会获得无限循环重定向。 I'm using the default htaccess supplied by WP for my subdirectory install. 我正在使用WP提供的默认htaccess进行子目录安装。 Here's what I have: 这就是我所拥有的:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) site/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ site/$2 [L]
RewriteRule . index.php [L]

FYI - My wp install is within a folder named 'site', and the issue is happening both on my local mamp install and on my hosting server. 仅供参考 - 我的wp安装位于名为“site”的文件夹中,问题出现在我的本地mamp安装和托管服务器上。

Here's the multisite info from my config file: 这是我的配置文件中的多站点信息:

define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', APP_URL);
define('PATH_CURRENT_SITE', '/site/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

I've spent the past 2 days googling, but to no avail. 我花了两天的谷歌搜索,但无济于事。 Here are the solutions I've tried that didn't help (actually, there are more but SO won't let me post more than two links yet): 以下是我尝试过的解决方案没有帮助(实际上,还有更多,但SO不会让我发布超过两个链接):

Any help would be appreciated. 任何帮助,将不胜感激。 I'm starting to get desperate :-/ 我开始变得绝望了: - /

The problem is with the .htaccess and the wp install being in the folder 'site'. 问题是.htaccess和wp安装在文件夹'site'中。 To fix this issue edit the .htaccess to reflect the wp directory. 要解决此问题,请编辑.htaccess以反映wp目录。

Options +FollowSymLinks
Options -indexes

RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^site/([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^site/([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^site/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^site/([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM