Coder Social home page Coder Social logo

wp-redirect-loop's Introduction

WP Redirect Loop

Prevent redirect loops with wp_redirect() function

If your installation has debug mode activated, any redirect loop will trigger a wp_die screen.

Installation

Just add the plugin to your project (as regular or mu plugin).

Changelog

1.0.3 - 2024-06-20

  • Don't remove trailing slashes before comparing URLs

wp-redirect-loop's People

Contributors

petitphp avatar herewithme avatar

Watchers

 avatar François Thibaud avatar James Cloos avatar  avatar  avatar

Forkers

wprobot

wp-redirect-loop's Issues

Relative path

The plugin dont detect infinite loop with relative path :

Code bugged, added on header.php

wp_redirect( $_SERVER['REQUEST_URI'] );
exit();

Test comparaison failed :

if ( untrailingslashit( $location ) === untrailingslashit( $this->get_current_url() ) ) {

string(22) "/blog/2019/11/18/test/"
string(48) "https://mysite/blog/2019/11/18/test/"`

Infinite loop on no trailing slash

When the website having no trailing slash this case :

  • example.com/coucou/ is redirect to example.com/coucou by wp-redirect-canonical and is considered as loop but is not.

If deactivate plugin is not loop redirection

easier backtrace

Use wp_debug_backtrace_summary for have a human version instead debug_backtrace ? :)

Infinite loop, page A to B ----- B to A

I add this code on header.php

wp_redirect( '/index.php' );
exit();

And WP force redirect too for remove /index.php
We have a infinite loop

I think to avoid this, it would be necessary to test with a call wp_remote_xxx to know if the URL loop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.