multiple-domain
multiple-domain copied to clipboard
Performance Improvement on Original Domains
Would it make sense to not process the plugin if the request was for the original domain? I notice that canonicals are inserted for original domain too - meaning the plugin is processing original domain pages as well.
private function __construct()
{
$this->initAttributes();
// Adding this could skip original domain processing, not? if($this->domain == $this->originalDomain) { return; } $this->hookActions(); $this->hookFilters(); $this->hookShortcodes();
new MultipleDomainSettings($this);
}
The above is a rough working Ideally the code needs to be optimised when it comes to delivering the Original Domain.
Hey @vkathirvel. Thanks for the suggestion. Yet, the change is not that simple. E.g. if one has a link inside a post pointing to https://otherdomain.com
and they're accessing the page from https://originaldomain.com
, that link won't get replaced. Clicking on it would take the user to a different domain. Does it make sense?
In any way, if you want to put some time on improving these checks, feel free to open a PR. I'll be happy to review it.
Thanks @straube I've been playing around with the tweaks and I figured it is more complex than I thought :) I'll see if I can improve the code. Thanks.
Hey @vkathirvel. While revisiting this issue I was thinking if an option would be useful here. We could add a new option to the plugin settings that allow site admins to disable the rewrite processing for the original domain. If they think it's safe to do so, i.e. everything from user-created content to uploads is on the main domain, they could enable this option. In this case, it'd default to processing on the original domain. Does it make sense?
We could add a new option to the plugin settings that allow site admins to disable the rewrite processing for the original domain.
Not going to work when cache plugin exists because the pages will be cached.
@Dibbyo456 If the site admin disables the rewriting, then purges the cache, isn't it supposed to work? Next time the page is cached, it'll use the original content with no rewriting applied.