我安装了一个新的WordPress 4.1多站点
我可以navegate Front并访问主站点仪表板
http://blog.urlcorrect.com/wp-admin/
我创建了一个子网站,但我无法访问子网站信息中心
http://blog.urlcorrect.com/br/wp-admin/
我有这样的错误:Códigodeerror: ERR_TOO_MANY_REDIRECTS
-
我可以访问Front
http://blog.urlcorrect.com/br/
但没有样式,css url不正确(找不到页面):
http://blog.urlcorrect.com/br/wp-content/themes/twentyfifteen/style.css?ver=4.1
-
我有这个值:
current blog domain: blog.urlcorrect.com
current site domain: blog.urlcorrect.com
current blog path: /
current site path: /
-
BBDD(wp_blogs表)
blog_id: 1
site_id: 1
domain: blog.urlcorrect.com
path: /
public: 1
blog_id: 2
site_id: 1
domain: blog.urlcorrect.com
path: /br/
public: 1
-
htaccess:
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).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
-
wp-config.php
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'blog.urlcorrect.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
-
我找不到正确的答案。我做错了什么?
非常感谢
巴勃罗
答案 0 :(得分:8)
(我不赞成给定的解决方案);)
如果您仍然遇到问题,请尝试使用.htaccess解决方案。
通过WP Network安装更改给定的.htaccess模板:
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).*) featured/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ featured/$2 [L]
RewriteRule . index.php [L]
对此:
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).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
与我的类似问题与你合作。
原始解决方案发布在link
答案 1 :(得分:1)
如果您正在使用Cloudflare,而不是像这样将SSL模式从灵活模式更改为完全模式:
这对我有用。
来源:https://wordpress.org/support/topic/wp-multisite-too-many-redirects-on-wp-admin/
答案 2 :(得分:0)
由于你有一个多站点WordPress,你应该删除这些行:
define('DOMAIN_CURRENT_SITE', 'blog.urlcorrect.com');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
来自wp-config.php
。
答案 3 :(得分:0)
我的诀窍是检查数据库。
查找表wp_options
并将option_name
siteurl
和home
的行从http://127.0.0.1/something
更改为http://localhost/something
答案 4 :(得分:0)
这意味着.htaccess无效,因为它是Apache。
如果您使用的是Nginx,则可能需要阅读WordPress Codex的Nginx页面:https://codex.wordpress.org/Nginx
我将在此处粘贴最重要的部分,以防食典出于任何原因脱机:
# WordPress multisite subdirectory rules.
# Designed to be included in any server {} block.
map $uri $blogname{
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ;
}
map $blogname $blogid{
default -999;
#Ref: http://wordpress.org/extend/plugins/nginx-helper/
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
server {
server_name example.com ;
root /var/www/example.com/htdocs;
index index.php;
location ~ ^(/[^/]+/)?files/(.+) {
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example.com/htdocs/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}
if (!-e $request_filename) {
# Don't use `$uri` here, see https://github.com/yandex/gixy/issues/77
rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
#add some rules for static content expiry-headers here
}
map $http_host $blogid {
default -999;
#Ref: http://wordpress.org/extend/plugins/nginx-helper/
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
server {
server_name example.com *.example.com ;
root /var/www/example.com/htdocs;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
#WPMU Files
location ~ ^/files/(.*)$ {
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
access_log off; log_not_found off; expires max;
}
#WPMU x-sendfile to avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example.com/htdocs/wp-content/blogs.dir;
access_log off; log_not_found off; expires max;
}
#add some rules for static content expiry-headers here
}
注意:创建网络时,WordPress网络安装不再需要blogs.dir
规则,但是在迁移较旧的安装时仍然需要。{em>