Php 为什么在多站点WordPress安装的子站点中访问wp admin会导致重定向过多?
我在安装多站点WordPress时花了很多时间。我已经做了大约两个星期了,并且犯了一些错误。我已经仔细阅读了论坛、博客和帮助文章,尝试任何可用的建议。已经取得了进展,但尚未完全奏效 URL信息Php 为什么在多站点WordPress安装的子站点中访问wp admin会导致重定向过多?,php,wordpress,nginx,mariadb,multisite,Php,Wordpress,Nginx,Mariadb,Multisite,我在安装多站点WordPress时花了很多时间。我已经做了大约两个星期了,并且犯了一些错误。我已经仔细阅读了论坛、博客和帮助文章,尝试任何可用的建议。已经取得了进展,但尚未完全奏效 URL信息 环境 Gentoo nginx MariaDB WordPress nginx配置文件位于:/etc/nginx/nginx.conf root example.com文件夹位于:/var/www/localhost/htdocs WordPress安装在:/var/www/localhost/
- Gentoo nginx MariaDB WordPress
- nginx配置文件位于:
/etc/nginx/nginx.conf
- root example.com文件夹位于:
/var/www/localhost/htdocs
- WordPress安装在:
/var/www/localhost/htdocs/WordPress
- 没有任何格式
- 向许多人展示 重定向
- 工作
- 工作
我删除了这个文件,因为我正在使用nginx。另外,这是交叉发布的:我的问题与这个问题类似,只是我正在使用nginx,因此我没有使用.htaccess。该线程中作为解决方案提供的nginx代码已经在我的nginx.conf中实现。()另外,这是交叉发布的:我的问题与此类似,只是我使用的是nginx,因此我没有使用.htaccess。该线程中作为解决方案提供的nginx代码已经在我的nginx.conf中实现。()
---Code Removed---
http {
---Code Removed---
map $uri $blogname{
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ;
}
map $blogname $blogid{
default -999;
kevin 2;
}
# Redirect all http requests to https
---Code Removed---
# Adding this to redirect all non-www.-having URLs to www.
---Code Removed---
# Server settings for all https requests
server {
---Code Removed---
root /var/www/localhost/htdocs;
location ~ ^(/[^/]+)?/files/(.+) {
try_files /wordpress/wp-content/blogs.dir/$blogid/files/$2 /wordpress/wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /wordpress/blogs.dir {
internal;
alias /var/www/localhost/htdocs/wordpress/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host/wordpress$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) /wordpress$2 last;
rewrite ^(/[^/]+)?(/.*\.php) /wordpress$2 last;
}
location ^~ /wordpress {
index index.php index.html index.htm;
try_files $uri $uri/ /wordpress/index.php?$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi.conf;
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm.socket;
}
}
location / {
try_files $uri $uri/ /wordpress/index.php?$args ;
}
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm.socket;
}
}
}
---Code Removed---
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/tmp/wp-debug.log');
/* Always use HTTPS */
$_SERVER['HTTPS']='on';
/** SSL */
define('FORCE_SSL_ADMIN', true);
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'www.draggoo.com');
define('PATH_CURRENT_SITE', '/wordpress/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy publishing. */
---Code Removed---
https://www.draggoo.com/wordpress
https://www.draggoo.com/wordpress/kevin
https://www.draggoo.com/wordpress
https://www.draggoo.com/wordpress/kevin
+---------+---------+-----------------+-------------------+
| blog_id | site_id | domain | path |
+---------+---------+-----------------+-------------------+
| 1 | 1 | www.draggoo.com | /wordpress/ |
| 2 | 1 | www.draggoo.com | /wordpress/kevin/ |
+---------+---------+-----------------+-------------------+