Login fails due to loop on localhost. Any ideas why?
-
16-10-2019 - |
Question
I have git cloned a site and used Backup and Migrate to bring the database over the the local host.
Working on the remote host the login works fine. Not locally. Well not anymore it worked for about an hour I'd say.
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
I've cleared all history, tried different browsers, and restarted apache a few times.
Any ideas?
EDIT:
I can install it and after installation I stay logged in for about 60 seconds after migrating the database. I'm then redirected in a loop.
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept cookies.
- I've cleared the browsers cookies and cache
- I've cleared drupals cache
- restarted apache
- tried different browsers
I'm beginning to think it may have something to do with how I'm setting up the site. I'm doing it in a very round-about way I think.
- backup database from dev site
- git clone site and point httpd.conf and hosts file at it
- create database with same name, user and password from settings.php file
- install site
- go in an enable backup and migrate
- import database from backup
site loads. drops after 60 seconds or so with the firefox message from above. I'm not 100% sure where to start troubleshooting.
Solution 2
sudo a2enmod rewrite
fixed it. That is all.
OTHER TIPS
You could find out for sure by adding some logging code in drupal_goto() to backtrace what function fired the redirect. Then inspect why that function fired the redirect and work back from there.
Or, some more "guesswork" approaches -
Check you don't have
$base_url
set in settings.php.Clear your cache tables after installing to copy (or don't back up the cache table contents).
drush cc all
- Disable modules which might be confused by relocation - securepages, canonical_url, logintoboggan (guessing here).
drush dis securepages canonical_url logintoboggan
- Check your variables table for (and delete) any entries with values like '%http://your.old.domain%'.
drush vget | grep your.old.domain
drush vdel some_variable_name
You should also check your server error log and also install Firebug (if you don't have it already) and check the "Net" tab to see the HTTP requests. From these 2 sources you should normally have something to point you in the right direction.
Same issue happened to me, infinite redirect loop
- I could see all the pages within my website but when I try to login with my credentials, it gives me this error. So, I couldn't access my site as an admin. I found some solutions like adding a module, but I can't add/disable
any modules. It took me around a day to resolve this,
Following steps worked for me in resolving this error:
Modified .htaccess file
RewriteBase /drupal
uninstalled a module
Voting api
module, deleted thevoting api
folder.cleared the
cache_* tables
in the database throughphpmyadmin
Modified
my.ini/my.cnf
file -max_allowed_packet = 32M.
hope it would help someone.
REF: