WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Login Redirection Page For All Multisite (11 posts)

  1. strang3r
    Member
    Posted 2 years ago #

    I would like to know what do I have to edit in my .httaccess for having this below result...

    When a person visit example.com/login or site1.example.com/login (no page exists with login name) in my multisite, I want them to be redirect into example.com/wp-admin or site1.example.com/wp-admin and I want this to happen all new websites get created and for the old sites which already been made.

    Any help please?.

  2. Easiest way?

    Redirect 301 /login /wp-admin/

    Should work.

  3. strang3r
    Member
    Posted 2 years ago #

    what would you do if you get 500 internal server error after having this code in .httaccess?.

    Because that is what happening.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    Redirect 301 /login /wp-admin/
  4. Always put the rules on top :)

    Redirect 301 /login /wp-admin/
    
    #Begin WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    #End WordPress

    Though looking into it, I think that redirecting to wp-admin is protected somehow. I can make it work, but it forces a login loop. This works:

    RewriteRule ^login/$ /wp-login.php [L]
  5. strang3r
    Member
    Posted 2 years ago #

    Hello lpstenu,
    You are the best!!!

    Its working but I am having a problem that. sometimes it give me 400 error. In random times. very rarely though... can you tell me how I fix it?.

  6. strang3r
    Member
    Posted 2 years ago #

    Do I put this in or replace it with another rule?

    RewriteRule ^login/$ /wp-login.php [L]

  7. Replace Redirect 301 /login /wp-admin/ with RewriteRule ^login/$ /wp-login.php [L]

    See if that works better.

  8. Digital-Ninja
    Member
    Posted 2 years ago #

    Dear Support,
    I am having a similiar need for login redirects, but after attempting the solution cited, I'm not getting the results I was hoping for. Let me explain the situation:

    WordPress Multisite (yes)
    2 sites
    First site is standard site
    Second site is Buddypress
    Using folders; not subdomains

    Goal:
    If a user navigates or clicks a link that would normally take them to the login screen for the Buddypress site installation, auto redirect to the login screen for the first site (main). Always use first site's login screen for all logins...

    Thanks for looking at this.
    s

  9. Digital-Ninja - Make your own topic please :)

  10. shawnkelshaw
    Member
    Posted 2 years ago #

  11. strang3r
    Member
    Posted 2 years ago #

    This problem has been fixed. Thanks for all your support Ipstenu!!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.