• I am having an issue with domain.com/wp-admin URL redirect to a wrong wp-login URL after I moved all WordPress files to a folder in public_html.

    1. WordPress was installed directly in public_html root. Everything works fine and I am able to login.

    2. I created a new folder ‘domain.com’ in public_html and moved all WordPress files to the new folder.

    3. I then use .htaccess to redirect the domain.com to access WordPress files in the ‘domain.com’ folder in public_html using the code below.

    -----
    # .htaccess main domain to subfolder redirect
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
    RewriteCond %{REQUEST_URI} !^/domain.com/
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)$ /sehalus.com/$1
    
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
    
    RewriteRule ^(/)?$ domain.com/index.php [L]
    -----

    4. So, there is no change for URL needed in the database or wp-config as we are still using the same domain.com

    5. When I try to go to https://domain.com/wp-admin it redirects to https://domain.com/wp-login.php?redirect_to=https%3A%2F%2Fdomain.com%2Fdomain.com%2Fwp-admin%2F&reauth=1 with two domain.com in it instead of one which is wrong and won’t be able to login.

    6. Even after clearing browser cache, it is still redirecting to the same wrong URL.

    7. Of course when I go to https://domain.com/wp-login.php?redirect_to=https%3A%2F%2Fdomain.com%2Fwp-admin%2F&reauth=1 there won’t be any issue with login.

    8. When I try to move all WordPress files back to public_html root, everything is working back to normal and no issue with redirection and login.

    How do I have all WordPress files in domain.com folder in public_html and fix the issue with wp-admin redirection URL at login?

    Thanks.

    • This topic was modified 3 years, 5 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issue with wp-admin login URL redirect to wrong wp-login URL’ is closed to new replies.