How to Debug Redirect Problems in WordPress

A nice Sunday over here and time to begin the day with some good news: The Better HTTP Redirects (WordPress Plugin) just got even better!

Redirect Debug Mode with Backtrace

I’ve added some improvement in the brand-new 1.2 version that is a helping hand if you need to debug wordpress redirect problems: Redirect Debug Mode. This feature is something I wanted to implement for a longer time but was not able until now.

The debug mode will get activated if you switch WP_DEBUG to true. Once active, the redirect debug mode will do two things:

  1. Prevent any automatic redirect
  2. Offer a redirect HTML body with a backtrace

The first will help you to deal with redirect loops because there will be no automatic looping any more and you can inspect the trail of redirects. This is enforced, which means that regardless of how you configured your browser: There will be no automatic redirect.

The backtrace will show which component did trigger the redirect actually, for example in the first screenshot you see that it’s triggered on line 161 in /wp-admin/options.php.

Xdebug Support

If you have got XDebug installed on your system, the function stack will be added as well.

I’ve just put it online as 1.2, so you can install it via the plugin search in your backend. However, you can grab the ZIP as well and just upload the single .php file into your mu-plugins directory because it’s a dual-mode plugin.

Hopefully this will help some of you as much as it did already helped me to get hard-to-debug redirect problems easier solved. It’s just so easy now!

In case you need to tackle redirect problems and you’re not using WordPress, I can always recommend the NoRedirect 1.2.4 Toolpress Strict Edition (Firefox Add-On).

This entry was posted in Plugin Plugout, Pressed, WordPress Support and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.