The DB_HOST line of your wp-config.php file points to the database server.
Thread Starter
duocia
(@duocia)
Yes, and it is pointing to remote database, but when I try opening website on my localhost I get redirected to that exact server. But how avoid redirecting but use same database is my question?
You can dynamically set the URLs WP_HOME and WP_SITEURL
See the first response at https://stackoverflow.com/questions/26014426/how-to-set-dynamic-home-and-siteurl-in-wordpress
At least, I think that’s what you’re asking about.
Thread Starter
duocia
(@duocia)
I have this in my wp-config:
$base = ‘/’;
define( ‘WP_ALLOW_MULTISITE’, true );
define( ‘WP_HOME’, ‘http://localhost/mmo’ );
define( ‘WP_SITEURL’, ‘http://localhost/mmo’ );
define( ‘MULTISITE’, true );
define( ‘SUBDOMAIN_INSTALL’, false );
define( ‘DOMAIN_CURRENT_SITE’, ‘localhost’ );
define( ‘PATH_CURRENT_SITE’, ‘/mmo/’ );
define( ‘SITE_ID_CURRENT_SITE’, 1 );
define( ‘ADMIN_COOKIE_PATH’, ‘/’ );
define( ‘COOKIE_DOMAIN’, ” );
define( ‘COOKIEPATH’, ” );
define( ‘SITECOOKIEPATH’, ” );
define( ‘NOBLOGREDIRECT’, ‘http://localhost/mmo’ );
but I get: Error establishing a database connection
Does your database allow remote connections? Check it’s config and the host’s firewall.
Thread Starter
duocia
(@duocia)
Yes, remote connections are allowed this is simple picture of what I want to achieve. https://prnt.sc/juhp6t
What is your DB_HOST line in each config? Also, does the DB_USER have permissions as DB_USER@localhost and DB_USER@yourotherservername?
Thread Starter
duocia
(@duocia)
define(‘DB_HOST’, ‘79.98.30.144’);
-
This reply was modified 7 years, 11 months ago by
duocia.
How is the DB_USER defined on the DB server? Does it have a wild card as host?
Thread Starter
duocia
(@duocia)
This is my connection lines, I know that connection works because, Because I made connection from my local phpmyadmin to remote database.
define(‘DB_NAME’, ‘mmo’);
/** MySQL database username */
define(‘DB_USER’, ‘mmo’);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘*****’);
/** MySQL hostname */
define(‘DB_HOST’, ‘79.98.30.144’);
so, on your own PC
mysql -u mmo -p***** -h 79.98.30.144 mmo
works? If not, what error do you get?
Thread Starter
duocia
(@duocia)
Just a bit modified line 🙂
https://prnt.sc/jui77h
Without define( ‘MULTISITE’, true ) website works fine, but I cannot access other sites…
-
This reply was modified 7 years, 11 months ago by
duocia.
-
This reply was modified 7 years, 11 months ago by
duocia.
Try a couple of things:
1. define( 'DB_HOST', '79.98.30.144:3306' );
and because I’m not sure about that
2. in /etc/hosts (or wherever your hosts file might be), add
79.98.30.144 mysql.remote.host, then use
define( 'DB_HOST', 'mysql.remote.host' );
Thread Starter
duocia
(@duocia)
I have Xampp, this should be in mysql config or apache?
I don’t use XAMPP. You’ll have to check its documentation.