So I just migrated from my dev server to the production server and I can see the site and CP login page fine. However, trying to login I get:

An Error Was Encountered This form has expired. Please refresh and try again.

I've Google'd around a bit but can't figure this one out yet. DB, server and browser cache all clear. Anyone had this before?

  • I assume you follow all the steps outlined in the ee migration guide right? ellislab.com/expressionengine/user-guide/operations/moving.html Commented May 1, 2014 at 13:36
  • 1
    maybe obvious but have you cleared all cookies? Have you tried setting: $env_config['allow_extensions'] = 'n'; $env_config['user_session_type'] = 's'; $env_config['admin_session_type'] = 's'; Commented May 1, 2014 at 14:50
  • Thanks guys but I'm no further on. Really weird. Host is trying to debug too, and now says they're able to login fine. I still can't though. Cleared caches, closed browser, etc... but still get the error. I might try the migration again in case something was missed.
    – Ian Ebden
    Commented May 1, 2014 at 15:47
  • Have you checked your Cookie Domain settings?
    – AllInOne
    Commented May 13, 2014 at 21:00
  • Hi. The Cookie Domain, Path and Prefix are all currently blank. I've tried specifying these too (in my config), but no joy.
    – Ian Ebden
    Commented May 14, 2014 at 8:30

2 Answers 2


Big thanks to Joel Bradbury for solving this one. I needed to add

$config['disable_csrf_protection'] = 'y';

to my config. Here's why:

It'll be because the tokens have been generated on a different base domain, and then it's moved and gotten stuck. Normally they're regenerated when they're detected as expired, but if it see's them as not expired, but invalid it can get confused. The hashes are kept in exp_security_hashes, just emptying that table will do it too.


This is a bug when the 'Cookie Consent Module' is installed on 2.8. Here are some temporary fixes for now:

  • Disable CSRF protection by putting the following line in your config:

    $config['disable_csrf_protection'] = 'y';

  • Disable the Cookie Consent Module.

  • Try the fix as explained on the Cookie Consent Module GitHub page (https://github.com/EllisLab/Cookie-Consent/issues/2). However, this will still set cookies.
  • Hey, thanks for the help but the cookie consent module isn't installed :( Also, weirdly it seems you can login using the latest version of Chrome. Shouldn't be a browser issue though surely.
    – Ian Ebden
    Commented May 13, 2014 at 15:54

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.