• Since updating to 4.5 I am stuck with an infinite redirect on the static front page of my site.

    It is similar to what is described in this thread https://www.ads-software.com/support/topic/infinite-redirect-problem-wp45-2014-theme-17?replies=6#post-8291825 but unfortunately the remedy there (making sure site and wordpress URL are all lowercase) did not apply in my case as they were already all lowercase.

    Site has a number of static pages, with one of them (“home”) set to be the root and another (“blog”) set to be the page for posts.

    WordPress is installed in a subdirectory, and configured to answer on root with:
    siteurl: https://www.stg.domain.com/
    wordpressurl: https://www.stg.domain.com/anotherdir/

    As described in the other thread, if I revert the settings->reading “your front page displays” to either “your latest posts” or “a static page” with “front page” setting set to “–select–” then the redirect loop is fixed, and it displays the latests posts page.

    If I set “front page” to the intended “home”, or any other static page, then the redirect loop persists. Viewing it in chrome inspector, it is just reloading the root URL over and over again. It is not a case of it sending to some other domain or page with a redirect_to param and then sending back in a loop.

    No other pages are affected. I can navigate directly to static page permalinks and they load fine. The panel loads fine. Login works fine.

    Appreciate any help as this is blocking me from updating to 4.5, and I would like to do so to have all the latest security and bug fixes.

Viewing 15 replies - 1 through 15 (of 32 total)
  • I’m having the same problem after upgrading to 4.5. I’m redirecting the to a subdomain for logged in admins, to get around some caching issues to do with CloudFlare CDN, ModPagespeed, etc. Since upgrading, this is no longer working on my static front page.

    https://www.example.com redirects to admin.example.com when a user is logged in. This works for all pages except the homepage, where a redirect loop between https://www.example.com and admin.example.com causes infinite redirects.

    It’s the changes on line 175 in wp-includes/canonical.php that are causing this issue.

    -		} elseif ( is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front')  && ! $redirect_url ) {
    +		} elseif ( is_page() && !is_feed() && 'page' == get_option('show_on_front') && get_queried_object_id() == get_option('page_on_front')  && ! $redirect_url ) {

    https://github.com/WordPress/WordPress/commit/84a3b4407f9e03311aa591004f3bec0639f3ba3f

    Same problem here, not fixed in wordpress 4.5.1. Removing the redirect_canonical filter solves the problem, but is not optimal for SEO reason.

    Had the same issue, 4.5.2, thank you so much for pointing it out @julianm

    Like Motaz Shazly, had the same issue with 4.5.2 (was using 4.5.1 on which this issue did not occur). Reverting the line back fixes it for me. Thank you @julianm

    I was able to get this fixed without hacking core using the following:

    function disable_front_page_redirect_madness($redirect_url) {
    	if( is_front_page() ) {
    		$redirect_url = false;
    	}
    
    	return $redirect_url;
    }
    
    add_filter( 'redirect_canonical', 'disable_front_page_redirect_madness' );

    Thank you Andrew for posting your solution which does not require editing the core.

    I had the problem in 4.5.2 and fixed it by editing wp-includes/canonical.php because it needed to be fixed immediately. But then an upgrade to 4.5.3 brought the problem back.

    Disabling the canonical redirect on the home page should survive upgrades.

    And maybe WordPress will eventually fix the bug?

    And maybe WordPress will eventually fix the bug?

    Not unless you let WordPress know.

    https://make.www.ads-software.com/core/handbook/testing/reporting-bugs/

    I was able to get this fixed without hacking core using the following:

    Andrew, where did you put your code to make to work?

    Hi Ms_Evette,
    You can put the code in functions.php of your theme or create a plugin out of it.

    Hi there, i think i have the some issue here after an update from 4.4. to 4.5.3.
    All Links to pages are redirected to the landing page. The<a>-Tags have the correct links (domain.com/pagename/) , but i get all the time redirects to the landing page (domain.com).
    Can anybody help me with that or knows about the Problem?

    Hi flofas,
    See my code snippet above and place it in functions.php and that should fix your issue. Let me know if it helps.

    Hello all,

    I just downloaded wordpress 4.5.3 and i have problem accessing to wp_config.php to setup the blog. It keeps redirecting me to the front page. Am wondering if you guys know what’s wrong? I really have no idea…

    Hi Andrew,

    You can put the code in functions.php of your theme or create a plugin out of it.

    I copied and pasted your code at the end of the functions.php file of my theme and nothing changed. Thank you for trying.

    Thanks Andrew! That helped me a lot.

    Today was a day when I begun meeting with nginx and I came across this bug what made me think that I won’t be able to use nginx but you actually saved me. Thanks again! ??

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘4.5 causes infinite redirect on static front page’ is closed to new replies.