I am on WordPress (single site) using the Transposh plugin to have an English and Spanish version of my site. I want to have an English domain (let's say www.english.com) for the English version, and a Spanish domain (spanish.com) for the Spanish version. I have set up spanish.com to forward with english.com with domain masking.
I have also added the following code to wp-config.php.
if (strpos($_SERVER['HTTP_REFERER'], 'spanish.com') !== false) :
define('WP_SITEURL', 'http://spanish.com');
define('WP_HOME', 'http://spanish.com');
endif;
In functions.php:
// If coming from spanish domain, make language spanish, regardless of query string
if (strpos($_SERVER['HTTP_REFERER'], 'spanish.com') !== false) {
$my_transposh_plugin->target_language = 'es';
}
.htaccess:
# This sees if the URL is from english.com and has lang=es
# in the query string. If it does, redirect to spanish.com
RewriteCond %{QUERY_STRING} ^lang=es [NC]
RewriteCond %{HTTP_HOST} ^www\.english\.com$ [NC]
RewriteRule ^ http://spanish.com%{REQUEST_URI} [R=301,L]
The only issue is that the changes have broken all of the autogenerated file links. CSS/JS/IMG links now go to http://spanish.com/wp-content/themes/theme/style.css. Because of the domain masking, that link would go to an html page with the css file embedded in a frame on the page. What is the best way to fix this?
EDIT: (My edit was wrong)