I have one site with a very strange issue that I have been fighting for months and I'm clueless. All I know is that with CiviCRM disabled, the issue does not occur.

When I attempt to log in and submit the login form, instead of being logged in I get redirected to some random page and 404. For example, it will say

Page /robots.txt not found

And I'm not logged in. The only way to log in is to disable CiviCRM via drush. Then everything works perfectly.

It's something in the DB because I can restore this DB to a fresh settings.php and civicrm.settings.php and the error persists.

The DB did go through an upgrade from D6 w/Civi4.5 to D7 w/Civi4.6, which is when the strange behavior started.

Thanks for your time and insights.

  • Is it really random, or are there a couple of specific pages it always tries to reach? If you try restoring just civi to an empty d7 site does it still happen? Maybe we can narrow it down to civi routes vs drupal routes.
    – Nicholai
    Commented Jun 17, 2015 at 19:20
  • Yeah, @Nicholai it actually is a handful of pages that it tries to reach. /robots.txt is one of them, and another one is some random node.
    – LunkRat
    Commented Jul 9, 2015 at 2:27

2 Answers 2


I discovered that this was caused by faulty PHP in the template.php file of my Drupal theme. Probably spent more than 40 hours trying to troubleshoot this, when in the end it was some custom code in my theme!


When I've experienced that general issue (Drupal login redirecting to wrong the page), it's been because Apache mod_rewrite was disabled.

However, some of your other symptoms are unfamiliar (eg being tied to Civi), so it may be a different issue.

  • Thanks Tim, I'm using nginx so no mod_rewrite here.
    – LunkRat
    Commented Jun 17, 2015 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.