[resolved] redirect_to redirects to URL prefixed with a slash: /http://... (3 posts)

  1. Aren Cambre
    Posted 4 years ago #

    My WordPress Network's redirect_to, on wp-login.php, is redirecting to a URL that has a / before the http! Here's background.

    I have a WordPress Network in subdirectory mode. The base blog is at /, and all other blogs are at /blogname/.

    Per http://wordpress.org/support/topic/redirect-all-login-attempts-to-root-login-page-with-mod_rewrite, I have this RewriteRule:
    RewriteRule ^.+wp-login.php(.*)$ /wp-login.php$1 [L,NC,R]

    This is because I am using the Active Directory Integration plugin. It's not network-aware, so I have to force all logins to happen on the base blog.

    The problem is that, probably thanks to a redirect_to query string, the end result is that I am redirected to a bad URL.

    For example, if I visit http://domainname.com/blogname/wp-login/php, I am taken to http://domainname.com/wp-login.php?redirect_to=http%253A%252F%252Fdomainname.com%252Fblogname%252Fwp-admin%252F&reauth=1. If I successfully authenticate, I end up at https://domainname.com/http%3A%2F%2Fdomainname.com%2Fblogname%2Fwp-admin%2F. Obviously, that doesn't work.

    I'm scratching my head at why this would be happening. Now, if I remove the $1 from the RewriteRule, it works fine. Maybe I should be happy with that? But it still bothers me that I have to truncate the URL to make this work.

  2. *blink* Man, you have the most awesomely weird problems. I am impressed! :)

    What if you try this:

    RewriteRule ^.+wp-login.php(.*)$ http://domainname.com/wp-login.php$1 [L,NC,R]

    I know, the / should work, but maybe it needs a kick in the pants?

  3. Aren Cambre
    Posted 4 years ago #

    Ha, thanks! Well, it turns out that the Active Directory Integration module may be more network-aware than I realized. All of a sudden, users can sign in to blogs other than the base blog. So for now, I've gotten rid of the RewriteRule, and everything is happy. I'll come back later if I do need to add it back.

Topic Closed

This topic has been closed to new replies.

About this Topic