WordPress.org

Forums

Wp-Admin has a redirect loop after migrating to new server (24 posts)

  1. frajdel
    Member
    Posted 1 year ago #

    Hi,

    I have recently moved all my wordpress-websites from a shared host to a dedicated server. Following the migration, we have experienced trouble accessing the wp-admin on a few of them. The front-end of every site is working just fine, and for the majority of them the wp-admin is working as well. However, on 4 websites i get an infinite redirect loop when I'm trying to access /wp-admin.

    We won't get any help whatsoever from our host it seems, so I'm turning to you as I have run out of possible sollutions.

    So let's start with what all these problem-sites have in common. They all have the same parent theme for starters. However, a lot of the sites that do work have the same parent theme as the ones that don't, so i'm not sure if the problem lies there. All the sites I use have been installed using the same method, same wordpress-version (3.5.1) and the same version of the themes, and they all look very similar to eachother, and from what I know, there shouldn't really be anything special with the sites that are not working.

    What I have tried so far:

    Switching of all plugins
    Made sure .htaccess doesn't have any redirects in it (also tried deleting the .htaccess)
    Changed to standard TwentyEleven theme in the database

    I have tried a number of other things as well, that I have found in similar threads, but none of them have worked. I'm not really that familiar with coding and such.

    I can't find anything obvious that stands out when comparing the working sites to the non-working sites, but it's hard when you're not sure what to look for. Thus I have no idea of what the root of the problem might be.

    Any help would be greatly appreciated, and if you require any more information just let me know and I'll provide it. Have been unable to access this for a couple of days now and I'm starting to get worried!

  2. Fathi
    Member
    Posted 1 year ago #

    Verify if you have an issue with the "www"
    Just try to access your admin page with and without the www

  3. Fathi
    Member
    Posted 1 year ago #

    If you have trouble with the full domain, then add this code at the bottom of your wp-config file:

    define('WP_HOME','http://www.yourdomain.com');
    define('WP_SITEURL','http://www.yourdomain.com');

    Just add the exact domain as worked in the past, if you used a simple domain.com without www then delete the wwww from the above code and don't forget to change "yourdomain" with your Url.

  4. jspurling
    Member
    Posted 1 year ago #

    Hi, having the exact same problem here - did you find a solution?

  5. Jeff
    Member
    Posted 1 year ago #

    Hi, I am also having the same problem - it'd be great to find a solution :-)

  6. MAX Website Design
    Member
    Posted 1 year ago #

    Fathi's solution worked for me. Just defined the absolute path before these lines:

    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');

    in the wp-config file as Fathi suggested.

  7. coldcedar
    Member
    Posted 9 months ago #

    I know absolutely NO CODING and I've been pulling my hair for a few hours. THANK YOU FATHI! THAT WORKED!

    I went into the File Manager of my web hosting control panel, found the wp-config file, then added those two define lines to the end of the file! Somehow, even an idiot like me was able to do this! I WIN THIS TIME COMPUTER, I win this time...

  8. coldcedar
    Member
    Posted 9 months ago #

    Oh the absolute horror. It worked for a while, but now it has a redirect loop again. And even worse, it's affected another wordpress site of mine. Now I can't access my other wordpress site dashboard and it redirects to this site for some reason and back to the log-in screen. Help!

  9. coldcedar
    Member
    Posted 9 months ago #

    Somehow those two lines of code went missing. I put them back in and my new site is working now, but now my old one redirects to my new one! Ah!

  10. coldcedar
    Member
    Posted 9 months ago #

    So now my new site's WP dashboard is working, but my old one isn't!

  11. coldcedar
    Member
    Posted 9 months ago #

    HAH! IT WORKS! IT WORKS! This is so strange! Now I'm using two laptops, and the laptop I usually use, my old site WORKS! But I can't access that site on my second laptop.

    I'll just carry two laptops around whenever I go to Starbucks and pretend to be interesting and yet so desperately, desperately lonely. Maybe I can invite a woman to use my other laptop. "Hey uh, want to use my laptop? I have two. I have two laptops. Please love me."

    edit: Now it seems like neither site will work on my second laptop but will on my first. But it just worked a second ago on my second. It may not seem like it, but I'm like really smart. I'm like a really smart person.

    EDIT: SECOND SITE NOT WORKING AGAIN! Defeated laughter! Oh help me...

  12. coldcedar
    Member
    Posted 9 months ago #

    It seems that when I disconnected Jetpack from my new site, it may have deleted the site, because now when I go to the site, it doesn't show wordpress, but my domain server's default 'empty' page. I guess I'll try reinstalling wordpress for my new domain.

  13. coldcedar
    Member
    Posted 9 months ago #

    Oh it's working again! But for how long? I reinstalled WordPress for that domain but it still redirected. Then I popped in those two lines of code. After a long wait, voila! It's working again!

  14. coldcedar
    Member
    Posted 9 months ago #

    I think there's also an issue with Jetpack or just simply linking the new domain with the old domain on the same WordPress account. UHHH!

    And possibly because I used Fantastico De Luxe to make my WordPress site with my first domain, and I used QuickInstall to make my second WordPress site. Could that be an issue?

  15. coldcedar
    Member
    Posted 9 months ago #

    Wait a minute wait a minute wait a minute. I don't think my two sites are on the same WordPress account. When I got to WordPress.com and type in my e-mail and password, VOILA! My first site works! But if I try to go to www."myfirstsite".com/wp-admin - NO DEESAY. If I go to www."mysecondsite".com/wp-admin and type in my username and password from QuickInstall, VOILA! Now I guess I'd like to connect the two on the same WordPress account. But all in all I'm happy. Well, this has been an ordeal. Thank you very much.

  16. coldcedar
    Member
    Posted 9 months ago #

    Nope, still have redirect problems. Absolutely insane. Going to try deleting the second site again and installing it through Fantastic De Luxe like the first site.

  17. coldcedar
    Member
    Posted 9 months ago #

    I've made a huge mess of things. I deleted the second site through QuickInstall (or so I believed), and tried to install it through Fantastico De Luxe, but then it said there were some files I had to delete manually, like wp-admin. I went into the File Manager and deleted as many files as I could, just a mass murder of files. Now there's all sorts of problems. I would make a great programmer. Now it gives me a 404 error, and so does my first site! I might have deleted my first site as well! Oh it's not a bad loss but yeah.

  18. coldcedar
    Member
    Posted 9 months ago #

    I completely deleted my first site. I didn't have a backup. Is there any way I can restore it?

  19. Lauramur
    Member
    Posted 9 months ago #

    coldcedar, I feel your pain, I WAS having the same issues as you and reading your blow-by-blow breakdown put a smile on my face :)

    But I have managed to fix my redirect loop! Yay! For me, it was a bit of a wordpress.com + wordpress.org issue as I got the redirect error as soon as I changed my domain nameserves from wordpress.com to wordpress.org. So I knew it wasn't a plugin issue because I hadn't even touched my wordpress.org site yet!

    So, here's what I did!
    First, I changed my domain to NOT be the primary domain on my wordpress.com account - this probably seems super obvious but it's never mentioned anywhere and just seems like something that would automatically change with the nameservers but nope! You can do it in the store>my domains section in the dash!

    Second, I put those lovely pieces of code from MAX Website Design and Fathi (thanks guys, you're both generous souls) into my wp-config (which, if anyone is lost, can be found in the public_html folder (in the c-panel file manager if you're on bluehost!)). It took me a little while to get it right (forgot to remove the www. as, coming from wordpress.com, my domain doesn't have one of those! ROOKIE ERROR!) but I got there in the end.

    And finally, EMPTY YOUR BROWERS' HISTORY/CACHE! I'm logged into wp on firefox and was trying to load my site unlogged-in on safari and it keep giving me the redirect error until I cleared my history. I guess because maybe it was still trying to direct me to the wordpress.com blog? But once I cleared it, it worked a CHARM!

    Anyway, I don't know if any of that will help you coldcedar (or anyone else) but I just thought I'd share it on the off chance! Best of luck everyone and here's hoping it sticks!

    and my site is lauraimurray.com although it's currently in maintenance mode so there isn't much to see :)

    thanks again everyone, you're all so generous.

  20. loudcanvas
    Member
    Posted 5 months ago #

    Allow me to throw my hat into the ring here. My answer to the problem was not described above. We run a suPHP configuration on our server, so file/folder permissions can actually cause a redirect loop for the wordpress wp-admin folder IF the files and folders do not have the correct permissions assigned.

    To fix this I simply login to SSH and run these commands:

    cd /home/{account}/public_html
    chmod -Rf 644

    This chmods ALL files/folders (recursively) to 644--which is what FILES they should be. Then run:

    find . -type d -exec chmod 755 {}\;

    This chmods all directories to 755 (correct setting).

    Voila. This fixed any redirect issues.

    One other thing which is important if you have moved the wordpress site from another account on the server (e.g. a subdomain on a dev domain) to a primary cpanel account, the user permissions may be incorrect. Go into wp-admin dir and simply to an ls -ltr to confirm that the folder/group match that of the account.

    If not - to fix this is easy:

    chown -Rf {user}:{user} *

    Problem fixed. :-)

    I should also point out that the BEST thing to do when facing a redirect loop (or any other sort of 500 error) is to tail the apache log file, i.e.:

    tail -f /usr/local/apache/logs/error_log

    Then try to hit the admin url. It'll explain the exact error and greatly help with troubleshooting.

  21. turquoisebearaz
    Member
    Posted 5 months ago #

    ABSOLUTELY LOST..HELP! My URL is registered thru GoDaddy as Turquoise-Bear.com My WP ID was turquoisebearaz. I migrated T-B.com and now I get a REDIRECT LOOP msg. I have 5 pages and several photos, but nothing displays when I attempt to log in. Any help is appreciated.

  22. turquoisebearaz
    Member
    Posted 5 months ago #

    Modification to my original question... I spoke with GoDaddy. It appears that they set up a forward from Turquoise-Bear.com to turquoisebearaz.wordpress.com. I appear to have created a forward from WP back to T-B.com; creating an endless loop. My question, now, is how to I turn off the loop from WP to Godaddy?

  23. Xtremefaith
    Member
    Posted 5 months ago #

    If its any help to anyone. I had this problem as well because as with most host, the only way to direct the primary domain to a directory other than root is to use a .htaccess method, and that works fine except when going to /wp-admin (no trailing "/") because when it redirects to the wp-login.php it adds a redirect_to parameter in the URL, which in my case meant it included the "_production" directory in the absolute path.

    I think this is a bug with WP, but either way the way to fix it was to insert this line in the _production directory .htaccess file.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]  <-- This line
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Hope that helps

  24. codyrauh
    Member
    Posted 4 months ago #

    fixed

Topic Closed

This topic has been closed to new replies.

About this Topic