2 Domains – 1 install – WordPress
Today I encountered this problem: I had one folder with a WordPress install and the client asked me to be accessible from two domain names.
Since it is shared hosting, and the primary domain is irrelevant, I couldn’t use the Add-on domain option. Also the re-direction is not acceptable – the client wanted www.mydomain1.com and www.mydomain2.com to appear as different websites with the same content.
The solution I followed was this:
$hostname = $_SERVER['SERVER_NAME']; $hostname = str_replace('www.', '', $hostname); if ($hostname == 'mydomain1.com') { define('WP_SITEURL', 'http://mydomain1.com'); define('WP_HOME', 'http://mydomain1.com'); }
From here: http://wordpress.org/support/topic/158824
This code is placed in wp-config.php (BACK UP EVERYTHING BEFORE TRYING THIS SOLUTION!!!). This code can be used with multiple domains – just use the if…else method in php.
My second problem was that the theme used a script which was reading images from the folder and it was  recognised as an external domain from the original install (mind=blown). The solution was to give absolute urls.
I changed this (not accurate):
<img src="<?php get_bloginfo('template')?>/wp-content/themes/bpress_mag/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=590&h=353&zc=1" border="0" alt="<?php the_title(); ?>" />
To this:
<img src="https://www.mydomain1.com/wp-content/themes/bpress_mag/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=590&h=353&zc=1" border="0" alt="<?php the_title(); ?>" />
This was the trick!