Wordpress Access via ssh tunnel

If you have an LAN installation of wordpress you can't access it via ssh tunnel, because WP has two options stored on db: siteurl and home.
These options are overwritable by defining two constants or by updating options directly (see this reference)

In this manner you can change statically them, but to access via tunnel they must be dynamic, than you have to add into wp-config.php this constants:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress'); 
define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress'); 
The only problem with this change is the absolute paths of the uploaded images by admin panel.

Possible solution for this:
  1. plugin to find and replace absolute paths with relative paths
  2. change wordpress behavior modifyng functions.php
  3. write a little plugin
  4. use an existing plugin 
UPDATE: I tried to add this constant in wp-config.php
define('WP_CONTENT_URL', '/path/to/wordpress/wp-content');
 and now the images have relative path


Posta un commento