I'm trying to build a website which can be accessed through the main domain, which will use the main theme. But can also be accessed through different domains which are saved in the database, these will use a different theme.
The problem I am having is that the main website uses the rainlab translations plugin which automatically changed the normal url to url+locale. This is something I do not want to use in my other theme, which results in a 404.
I change the theme in my own plugin like so:
$currentHostUrl = Request::getHost();
Event::listen(
'cms.theme.getActiveTheme',
function () use ($currentHostUrl) {
$domain = Domain::where('domain', $currentHostUrl)->first();
if($domain !== null)
{
return 'differentTheme';
}
}
);
This is based on the way keios made their multisite plugin.
I would like to know how I can stop the localisation url change when the other domains are visited.
I found out it was the htaccess file that was doing the redirect, so i added a rewrite condition and that did the trick:
RewriteCond %{HTTP_HOST} ^www.domain.com$