Prevent redirect loops with wp_redirect() function
If your installation has debug mode activated, any redirect loop will trigger a wp_die screen.
Just add the plugin to your project (as regular or mu plugin).
- Don't remove trailing slashes before comparing URLs