[wp-hackers] How to turn localhost into 192.168.1.199 (or whatever)

Philip Walton philip at philipwalton.com
Tue May 3 05:29:10 UTC 2011


Amazing! Thanks John.

It doesn't seem to work in multisite, but I can certainly get around 
that for plugin testing. And I think the MU Domain Mapping plugin would 
probably work for that anyway.

Thanks again.

On 5/2/11 10:14 PM, John Blackbourn wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list