• Hi all,

    I have a few sites all running the same content with a few country specific differences, each under different domain names. This has worked perfectly for years. Each site has it’s own entry under Apache, each having it’s own wp-config.php with these two lines:
    define(‘WP_HOME’,’https://www.optilead.com/’);
    define(‘WP_SITEURL’,’https://www.optilead.com/’);
    to tell each instance what it is.

    The latest WordPress update just broke it, but only for the homepage, which now redirects to the main site (the URL entered on the General Settings page in WP-Admin).

    So:
    https://www.optilead.co.uk/ (this is the main site and works fine)
    https://www.optilead.com/ (this now redirects to the above)

    Anyone have any ideas as to how to stop it issuing the 301 redirects and just serve the content like it used to before the update?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter yorkiebar

    (@yorkiebar)

    Sorry, meant to add, everything works fine, as it used to do, outside the homepage.

    So:
    https://www.optilead.com/solutions/cart-recovery/
    and
    https://www.optilead.co.uk/solutions/cart-recovery/
    equally serve out their content, with country specific variations, without redirecting.

    We’re suffering from a similar problem – did you get anywhere with it, or work out what change to WordPress caused it?

    We’ve quite a complex system of proxies and redirects, unfortunately.

    Thread Starter yorkiebar

    (@yorkiebar)

    Not yet. The site it redirects to is the one entered in the “Site Address (URL)” box, it now seems to ignore WP_HOME and WP_SITEURL on the homepage. The sub-pages all work fine for some reason.

    Someone suggested the following to help track down where in the logical flow the redirect is coming from:
    You could also try hooking into the different actions in order, going down the list, to see how far it is making it and confirm the WP values: https://codex.www.ads-software.com/Plugin_API/Action_Reference

    add_action( ‘registered_taxonomy’, function(){ die( siteurl() ); } );

    But I’m not sure where to do that, it’s beyond my WP knowledge.

    Always got the option of dropping back a version if I can’t get it sorted soon.

    Thanks!

    We narrowed it down to the redirect_canonical filter.

    It is enabled in wp-includes/default-filters.php as a global filter, and the code for it is in wp-includes/canonical.php.

    It has changed in various ways from WordPress 4.4.2 to 4.5.

    Luckily we don’t need the filter, as we do redirects like the www version of our site at a higher level in the web server configuration.

    Thread Starter yorkiebar

    (@yorkiebar)

    Ok, making some progress. I’ve not worked exactly what the bug is that’s causing the issue, php isn’t my first language. However, it’s in this file:
    <wp_base>/wp-includes/canonical.php
    somewhere in redirect_canonical()

    Putting the old version of canonical.php back cures my issue. There doesn’t appear to be much changed in there, but there are a couple of changes involving is_front_page() which I think it where the issue lies. Hopefully, frabcus, this will work for you too.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘4.5 update broke my sites with 301 redirects’ is closed to new replies.