![](/img/trans.png)
[英]Migrate WordPress Multisite from localhost to public hosting (Error establishing a database connection
[英]Wordpress Multisite “Error establishing a database connection” issue
我研究了很多的#2問題像這樣 ,和網,但沒有解決我的問題。
我在域X上的多站點工作正常。 現在,我將其所有DB URL Replace移至我的服務器。 我也相應地更改了wp-config
和htaccess
。
問題是當我設置define('MULTISITE', false);
如果為false
則僅運行基礎站點,對於其他子站點,則顯示404
錯誤。
但我多點,我剛搬到我的實例,並且必須具有MULTISITE
作為true
的多點工作。
現在,當我將其設置為true時,我得到
建立數據庫連接時出錯
錯誤。 我不知道到底發生了什么。 我調試了但無法解決。
我的多站點配置代碼
/* Multisite */
define('WP_ALLOW_REPAIR', true);
define('MULTISITE', true);
define('WP_ALLOW_MULTISITE', true);
//define('RELOCATE',true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
$base = '/';
define('PATH_CURRENT_SITE', '/smart_facility_linux/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
//我的Htaccess(沒有任何問題)
RewriteEngine On
RewriteBase /smart_facility_linux/
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]
#RewriteRule ^privacy-statement.html /privacy-statement [L]
我解決了它並起作用了:)
在wp_blogs
表中,
舊結構是
Domain : localhost/smart_facility_linux
Path : /
但我將其更改為使其工作如下:
對於根站點:
Domain : localhost
Path : /smart_facility_linux/
對於子站點1(主站點下的任何子站點,我都給出了示例):
Domain : localhost
Path : /smart_facility_linux/subsite1/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.