[wp-hackers] Wordpress in Multiple Environments

Ryan Bilesky rbilesky at gmail.com
Mon Jan 17 05:40:00 UTC 2011

My guess is the uploads get the domain from the siteurl setting, as long as
that's set to the production site url then the uploads work fine, then when
being outputted you use andrews code to rewite the links, being that
directory structure should be the same that would work.

Or I could be mistaken about that, but that's my guess.

On Jan 16, 2011 5:30 PM, "Mike Schinkel" <mikeschinkel at newclarity.net>
> On Jan 16, 2011, at 8:07 PM, Andrew Nacin wrote:
>> The simplest solution is to run an output buffer in staging that rewrites
>> any live links. Works extremely well and doesn't put any additional
>> onto the production site. It also helps in a number of other areas
>> the media library. You might want to conditionally filter the uploads
>> anyway the same way you're filtering home and siteurl.
>> It could literally be as simple as this in wp-config.php:
>> ob_start( 'mysite_staging_links' );
>> function mysite_staging_links( $content ) {
>> return str_replace( 'http://mysite.com/', 'http://staging.mysite.com',
>> $content );
>> }
> How does that address the URLs saved to the database by images uploaded
when in the staging environment?
> -Mike
> _______________________________________________
> 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