In multiple-domain-mapping-on-single-site/multidomainmapping.php
Find and replace the function.
//change the request, check for matching mappings
public function parse_request($do_parse, $instance, $extra_query_vars){
//store current request uri as fallback for the originalRequestURI variable, no matter if we have a match or not
$this->setOriginalRequestURI($_SERVER[‘REQUEST_URI’]);
//definitely no request-mapping in backend
if(is_admin()) return $do_parse;
//loop mappings and compare match of mapping against each other
$mappings = $this->getMappings();
if(!empty($mappings) && isset($mappings[‘mappings’]) && !empty($mappings[‘mappings’])){
foreach($mappings[‘mappings’] as $mapping){
//first use our standard matching function
$new_url = explode(‘?’, $this->getCurrentURI());
$new_url = trailingslashit($new_url[0]);
$matchCompare = $this->uriMatch($new_url, $mapping, true);
//then enable custom matching by filtering
$matchCompare = apply_filters( ‘falke_mdmf_uri_match’, $matchCompare, $new_url, $mapping, true );
//if the current mapping fits better, use this instead the previous one
if($matchCompare !== false && isset($matchCompare[‘factor’]) && $matchCompare[‘factor’] > $this->getCurrentMapping()[‘factor’]){
$this->setCurrentMapping($matchCompare);
}
}
//we have a matching mapping -> let the magic happen
if(!empty($this->getCurrentMapping()[‘match’])){
//store original request uri
$this->setOriginalRequestURI($_SERVER[‘REQUEST_URI’]);
//set request uri to our original mapping path AND if we have a longer query, we need to append it
$newRequestURI = trailingslashit($this->getCurrentMapping()[‘match’][‘path’] . substr(str_ireplace(‘www.’, ”, $new_url), strlen(str_ireplace(‘www.’, ”, $this->getCurrentMapping()[‘match’][‘domain’]))));
//enable additional filtering on the request_uri
$_SERVER[‘REQUEST_URI’] = apply_filters(‘falke_mdmf_request_uri’, $newRequestURI, $new_url, $this->getCurrentMapping());
}
}
return $do_parse;
}