• Resolved tenserd

    (@tenserd)


    Hi there,

    first of all … the plugin works in one direction, from the domain directly to the website and that is a perfect time saver.

    I have problems with the canonical URL, which is not exchanged and therefore the force-redirect will probably not work.

    In my installation I use Woocommerce, but only as a catalogue and as a theme I use Divi (elgegantthemes.com).

    For testing, you can use domains that are also listed on the start page:
    https://maisfeld.eu
    https://pflegenotstand.eu
    https://amboolents.com
    https://blutgasse.de/

    Is there any more information missing?

    Many thanks in advance,
    Dennis

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Joeri van Veen

    (@ruigehond)

    Hi @tenserd

    Thank you for using my plugin and contacting me about this! I wanted to look into it today but did not find the time. Will get back to you here within the next few days.

    Kind regards,
    Joeri

    Thread Starter tenserd

    (@tenserd)

    Hi Joeri,

    thank you for going into this but…

    … somehow I realised yesterday when using your plugin that I was taking a completely wrong approach. Since I want to place adverts on the subpages, I would have to register each domain with Google and that would be really bad with up to 100 domains.

    So I’m now looking for a plugin that automatically assigns the main domains to the subpages … similar to yours in that it automatically recognises which subpage belongs to the domain, but does not retain the domain, but simply redirects to the corresponding subpage.

    I have not yet found a plugin for this.

    All the best
    Dennis

    • This reply was modified 6 months, 1 week ago by tenserd.
    Plugin Author Joeri van Veen

    (@ruigehond)

    Ah yes, thank you for getting back to me with that. Good luck finding the plugin you need. Thank you for trying mine.

    Your use case is interesting, so I looked into my code. Unfortunately, it is not as simple as I hoped, I would have to change quite a bit of stuff. Might be a nice addition though, contemplating it. Please let me know if you find another plugin that does what you need.

    Kind regards,
    Joeri

    Thread Starter tenserd

    (@tenserd)

    I’ve tried a few plugins and I couldn’t find anything using a search engine. Now I thought I could ask ChatGPT and they recommended, among other approaches (use of .htaccess or a PHP solution), the ‘Redirect Redirection’ plugin (from Inisev).

    I hadn’t had this plugin on my screen before and a quick test… it works:

    https://pflegenotstand.eu/ now redirects to
    https://webtyphoon.domains/domain/pflegenotstand-eu/

    I’m not sure if many people will use this type of redirection, as not everyone wants to sell domain names. But if this were also possible in your plugin, especially automatic recognition and forwarding … then I would at least be a user or if you wanted to offer this in a pro version, I would also be willing to make my contribution : )

    I have seen that there is no translation of your plugin into German yet. I’ll have a look at it today.

    All the best
    Dennis

    Thread Starter tenserd

    (@tenserd)

    Ok… this plugin didn’t work either. I took a closer look and wrote a function, but understandably I also had to get external help … regex gibberish…

    add_action('wp', 'redirect_based_on_domain');
    function redirect_based_on_domain() {
        if (strpos($_SERVER['HTTP_HOST'], 'mysuperduperdomainname') !== false) {
            // No redirection for the main domain
            return;
        }
    
        $host = $_SERVER['HTTP_HOST'];
        if (preg_match('/^(www\.)?([^\.]+)\.[a-z]{2,}$/', $host, $matches)) {
            $domain = str_replace('.', '-', $matches[2]);
            // Swap dot for a minus
            $redirect_url = 'https://mysuperduperdomainname/domain/' . $domain . '/';
            wp_redirect($redirect_url);
            exit();
        }
    }

    Perhaps this will help you to consider integrating it into your plugin.

    All the best
    Dennis

    Plugin Author Joeri van Veen

    (@ruigehond)

    Hi @tenserd, thank you for sharing your experience and the function you created.

    As my plugin is slightly more complicated I’d need to change some more internals to accomodate this functionality (it also keeps a list of valid posts for instance), but it definitely seems feasible.

    Thanks again, kind regards,
    Joeri

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘use_canonical & force_redirect not working’ is closed to new replies.