[wp-hackers] OT: htaccess and two domains...

Aaron Harun admin at anthologyoi.com
Wed Mar 19 17:34:05 GMT 2008

If you set them up as "parked" domains, then all you have to do is
filter all WP calls to the siteurl and blogurl and replace the "set"
domain with the one the user is currently on.

add_filter('option_home', 'fix_link',1);
add_filter('option_siteurl', 'fix_link',1);

function vfix_lins ($link){
$url = str_replace(array('www.','./'),'',$_SERVER['HTTP_HOST']);

	$link = preg_replace('/(http.*?\:\/\/w*\.*)(.*?)(\/.*)/','${1}'.$url.'${3}',$link);
return $link;


On 3/19/08, Mr. Awesome <theone.andonly.mr.awesome at gmail.com> wrote:
> For all you htaccess gurus out there, here's one for you... How can you
>  get TWO domains, to act as one, depending on the one you land on? Like...
>  If user Joe comes in on your domain.COM domain, at like. ..
>  domain.com/?p=2 and then you'd want to have the .NET work and take user
>  Joe to the same place, just on the .NET, like such: domain.com/?p=2 if
>  user Joe went there, he'd be getting the same posts, pages, etc etc
>  without getting 404s and etc. Without mirroring and all that too... When
>  I had my old host 100megswebhosting.com... they did it for me.
>  I had TWO domains, taking people to same place... and no matter which
>  one they landed on, it was at same place, acting like normal blog
>  without 404s...
>  domain1.com/?p=2 user got post 2
>  domain2.net/?p=2 user got post 2 same as they would on domain1.com/?p=2
>  I hope this isn't confusing... but I got back my original domain:
>  vindictivebastard.com and instead of having it redirect to the .NET, I'd
>  like the .NET and .COM acting together as one blog, just two separate
>  domains.
>  _______________________________________________
>  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