im trying to connect my local wordpress install to a db on a domain i own using the code provided here: https://coderwall.com/p/ck8v4a/remote-database-with-local-wordpress-instance
define('WP_CACHE', true); $currenthost = $_SERVER['HTTP_HOST'];
$mypos = strpos($currenthost, 'localhost/wpdir');
if ($mypos === false) {
define('WP_HOME','http://example.org/wpDir/');
define('WP_SITEURL','http://example.org/wpDir/');
} else {
define('WP_HOME','http://localhost');
define('WP_SITEURL','http://localhost/wpDir/');
}
with the above config i can open the site locally, it loads the navigation and recent post names correctly, so the db-connection seems to work. i cannot use links and pages are not found though.
if i add my /wpDir/
to the define('WP_HOME'...
and/or strpos($currenthost,...
it gets redirected to http://localhost/wpDir/home/
(as it should) but i get an URL not found error.
my localhost dir is standard /var/www/html
this is where my local wordpress installations are.
any ideas how to fix this?
update: i am back to working on this and it would really help a lot if i could manage to use the remote database for my local testing i think it may be some kind of url rewriting problem but all my efforts to find a solution did not work...