[wp-hackers] How to turn localhost into 192.168.1.199 (or whatever)
John Blackbourn
johnbillion+wp at gmail.com
Tue May 3 05:14:24 UTC 2011
On 3 May 2011 06:05, Philip Walton <philip at philipwalton.com> wrote:
> Is anyone aware of a relatively simple way to trick WordPress into allowing
> it to run on a different domain and/or file path?
You can define WP_HOME and WP_SITEURL (your site's 's home URL and
your WordPress installation URL respectively) in your wp-config.php
file [1] and these will be used instead of the values in the database.
You'll then be able to access the site at the domain/IP you define.
One thing to note is that if you have embedded media in your posts
these will likely be pointing to localhost. You can add a filter to
the_content as a quick workaround as this is just a test site. Eg:
function not_so_localhost( $content ) {
return str_replace( 'http://localhost/', 'http://192.168.1.199/', $content );
}
add_filter( 'the_content', 'not_so_localhost' );
John
[1] http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29
More information about the wp-hackers
mailing list