[Resolved] Redirect all login attempts to root login page with mod_rewrite
I have a mutlisite set up in subdirectory mode. I am using the Active Directory Integration plugin, which isn’t network aware, so it only works on the base blog.
If a user signs in on the base blog (to which he is automatically a subscriber), then he can go to My Sites, then find his site.
However, if a user visits the wp-login.php for any subdirectory blog, he can’t sign in. Again, the Active Directory Integration plugin isn’t network aware, so you have to sign in via the base blog.
I want to redirect all hits from sub-blogs’ login pages back to the base blog’s login page. This ought to work:
RewriteRule ^.+wp-login.php(.*)$ wp-login.php$1 [L,NC]
And, indeed, http://martinmelin.se/rewrite-rule-tester/ says it will work.
Except it doesn’t.
All the other rules in my .htaccess appear to be working fine. Except this one. And this one is the first RewriteRule in my .htaccess!
Is there something up with WordPress that would cause this to happen? I figured mod_rewrite stuff would fire before any PHP code runs?
Just for grins, I turned on RewriteLog at log level three. Here’s where it’s trying to parse that rule for a visit to a sub-blog:
add path info postfix: /path/to/website/subblog -> /path/to/website/subblog/wp-login.php strip per-dir prefix: /path/to/website/subblog/wp-login.php -> subblog/wp-login.php applying pattern '^.+wp-login.php(.*)$' to uri 'subblog/wp-login.php' rewrite 'subblog/wp-login.php' -> 'wp-login.php' add per-dir prefix: wp-login.php -> /path/to/website/wp-login.php trying to replace prefix /path/to/website/ with / internal redirect with /wp-login.php [INTERNAL REDIRECT]
I’m at a loss on how to interpret this, but I thought the 4th and 5th lines were curious.
- The topic ‘[Resolved] Redirect all login attempts to root login page with mod_rewrite’ is closed to new replies.