Support » Fixing WordPress » Can’t login with long url-redirected

  • Resolved xtimedt69

    (@xtimedt69)


    I installed wordpress in a sub-directory on my server, then used the .htaccess file code to redirect to my install. That part works fine. However, whenever I try to go to the wp-admin it automatically adds a redirect and creates a long url:

    http://www.strandzandthreadz.com/wp-admin.php becomes:

    http://www.strandzandthreadz.com/wp-login.php?redirect_to=http%3A%2F%2Fwww.strandzandthreadz.com%2Fstrandz2017%2Fwp-admin%2F&reauth=1

    The long URL will not allow me to login and I have to shorten the URL to:

    http://www.strandzandthreadz.com/wp-login.php

    I have no problem using the workaround, but my users are baffled by it and give up.

    I got on with my service provider to try to fix this and they said they can’t fix it, it is a wordpress problem and they referred me to this support forum.

    I got the .htaccess code for redirect as suggested by worpress documents:

    # .htaccess main domain to subfolder redirect
    # Copy and paste the following code into the .htaccess file
    # in the public_html folder of your hosting account
    # make the changes to the file according to the instructions.
      
    # Do not change this line.
    RewriteEngine on
      
    # Change yourdomain.com to be your main domain.
    RewriteCond %{HTTP_HOST} ^(www.)?strandzandthreadz.com$
      
    # Change 'subfolder' to be the folder you will use for your main domain.
    RewriteCond %{REQUEST_URI} !^/strandz2017/
      
    # Don't change this line.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
      
    # Change 'subfolder' to be the folder you will use for your main domain.
    RewriteRule ^(.*)$ /strandz2017/$1
      
    # Change yourdomain.com to be your main domain again.
    # Change 'subfolder' to be the folder you will use for your main domain
    # followed by / then the main file for your site, index.php, index.html, etc.
      
    RewriteCond %{HTTP_HOST} ^(www.)?strandzandthreadz.com$
    RewriteRule ^(/)?$ strandz2017/index.php [L]

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi xtimedt69,

    This problem has been solved also on stackexchange.
    I reproduced your problem and you only need to add this line on the bottom of your .htaccess file:

    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    Please note that the redirect is cached in your browser, so after you change the .htaccess file you may need to force refresh in the browser ( CTRL+R or CMD+R ) to see the change.
    Also try the browser’s incognito mode to avoid your browser’s cache.

    • This reply was modified 2 years, 10 months ago by eatzeni. Reason: more infos

    That fixed it,

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t login with long url-redirected’ is closed to new replies.