Support » Fixing WordPress » 4.5 causes infinite redirect on static front page

  • sqweak

    (@sqweak)


    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://wordpress.org/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: http://www.stg.domain.com/
    wordpressurl: http://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 - 16 through 30 (of 32 total)
  • I copied and pasted your code at the end of the functions.php file of my theme and nothing changed. Thank you for trying.

    Hi Evette,
    have you tried it on the same browser and session with same cached data and cookies? If so, try again that code but either clear cached browser data or try in incognito mode. So, you could actually see the result.

    Hope it helps.

    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! 🙂

    @thevukaslt – great! Glad to hear it helped.

    either clear cached browser data or try in incognito mode

    Good tip – I was using Chrome and it cached the redirect pretty heavily even after the fix.

    Good tip – I was using Chrome and it cached the redirect pretty heavily even after the fix.

    Exactly! Browsers are tend to cache permanent redirects (301) and since WordPress uses 301, so even after fix we wouldn’t see unless would use different browser or incognito mode.

    To note: I use Chrome for developing and to clear data for particular domain navigate to Settings -> Show Advanced Settings -> Content Settings (first button under Privacy) -> All cookies and site data ->(new window pops-up)-> Enter your domain into search box and remove data for each domain you worked with. And this way you won’t loose cookies for other sites.
    🙂

    Still not fixed in 4.6.1: if you have special characters in your domain name the problem will keep occurring.

    Thank you guys! adding the code in functions.php section solved this problem for me

    Steph Miles

    (@digitalsmiles01)

    Thank’s Andrew, You’re a legend. That piece of code fixed the annoying redirect issue for me as well. Thanks again.

    @digitalsmiles01,

    That piece of code fixed the annoying redirect issue for me as well. Thanks again.

    Awesome – glad it helped you out!

    Andrew you are a hero.

    Thank you! I was able to implement your code to resolve a problem with WordPress 4.6.1 and post a reply and credit to you at https://wordpress.org/support/topic/preventing-redirection-of-wordpress-indexphp-to-indexhtml-in-public_html/#post-8460182

    FYI: this is still an issue in vesion 4.6.1.
    My install is out-of-the-box fresh and only using theme Twenty Fourteen and bbPress.

    I commented out the code indicated from Julian and it now works great.

    Andrew, you’re a genius! Thanks so much for your fix to functions.php

    I had the same problem in WordPress 4.7, when a static front page is set with Permalinks setting ‘Date and name’. Infinite redirect loop on the front page, which would only display if I set permalinks to ‘Plain’. After applying your patch I can use a static front page together with pretty permalinks, no problem. Our site URL is reverse proxied, don’t know if that is a contributing factor.

    so i have discovered that i made a category slug named blog that somehow and from that point on the static page www.domain.com/blog/ started to redirect to www.domain.com.

    Finally,
    renaming the category slug to something else like blog-post removed the auto redirections.

    now everything is back to normal and the static blog page is accessible via http://www.domain.com/blog/ url.

    so, you might have to check if your blog slug term is unique on your wordpress site.

    good luck!

    no snipped code required for me.

    hi
    Thanks Andrew this works for me but the only problem is that the main page don’t load the fonts but when I explore other pages of my site font will be loaded, what the problem?
    sorry for my English.

    Hi aminabdiyan,

    Unfortunately I can’t diagnose the issue with just that information.

    My suggestion would be to disable all plugins and switch the a default theme, like twentysixteen, then see if the issue persists.

    You can also try upgrading to the latest version of WordPress (currently 4.7.2).

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