multiple-domain icon indicating copy to clipboard operation
multiple-domain copied to clipboard

Performance Improvement on Original Domains

Open vkathirvel opened this issue 5 years ago • 6 comments

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);
}

vkathirvel avatar Aug 19 '19 14:08 vkathirvel

The above is a rough working Ideally the code needs to be optimised when it comes to delivering the Original Domain.

vkathirvel avatar Aug 20 '19 12:08 vkathirvel

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.

straube avatar Aug 20 '19 15:08 straube

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.

vkathirvel avatar Aug 20 '19 15:08 vkathirvel

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?

straube avatar Oct 15 '19 11:10 straube

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.

harryqt avatar Dec 24 '19 14:12 harryqt

@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.

straube avatar Jan 09 '20 14:01 straube