1

I have a problem after migrating a WordPress site from Plesk and IIS to LAMP server.

I cannot access the Admin Panel, I can access /wp-admin/ and can login successfully but I get redirected to the home page and not to Admin Page.

If I set define('WP_DEBUG', true) in wp-config.php file I get this error:

Notice: Use of undefined constant _COOKIE - assumed '_COOKIE' in public_html/wp-content/themes/Avada/includes/fusion-functions.php on line 390 Sorry, you are not allowed to access this page.

This line has the following code:

if (!current_user_can('read') && !isset(${_COOKIE}['wp_min'])) {

I have manually added .htaccess file during migration and its content is:

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

UPDATE

PHP version is 7.0.27 and used to be 5.4.

I have already tried:

  • Renamed plugins folder
  • Changed to default theme (my editing database entry in table options)
  • Changed keys in wp-config.php
  • Added to wp-config.php file

    define(‘ADMIN_COOKIE_PATH’, ‘/’);
    define(‘COOKIE_DOMAIN’, ”);
    define(‘COOKIEPATH’, ”);
    define(‘SITECOOKIEPATH’, ”);
    

None of these has helped. I still cannot access the Admin Panel. Error remains the same.

1

There is not enough information to pin point the redirection issue.

Here is what you can do to pin point the issue:

  • Check if your new url is somehow different from old url. If its different then you will have to update your urls in database.
  • Check and compare PHP versions of your old and new environments.
  • Try to rename the active theme to temporarily disable it and then try to access the admin.
  • Try to disable all plugins by renaming them and check if you can access the admin panel.

Further more please check wp-config.php for following constants:

ADMIN_COOKIE_PATH
COOKIE_DOMAIN
COOKIEPATH
SITECOOKIEPATH

If the above mentioned constants are defined then check their paths else try adding following line in your wp-config.php

define(‘ADMIN_COOKIE_PATH’, ‘/’);
define(‘COOKIE_DOMAIN’, ”);
define(‘COOKIEPATH’, ”);
define(‘SITECOOKIEPATH’, ”);

Here is the reference url: https://wordpress.org/support/topic/cookie-error-site-not-letting-me-log-in/

You can also check out this question here: https://stackoverflow.com/questions/20941328/wordpress-admin-login-cookies-blocked-error-after-moving-servers

  • I edited my post – John Padiou Nov 21 '19 at 11:17
  • @JohnPadiou sorry for late response. Have you checked your permissions and ownership of files and folders? Folder permissions should be 755 and file permissions should be 644. While file and folder should be under your ownership and group. Also if its possible then try switching to php 5.6. – Muhammad Mehroz Anjum Nov 22 '19 at 12:26
1

This is likely due to the fact that the table prefixes changed during migration.

Update the wp-config.php file to the updated prefix.

Hope this helps.

  • Hello, Tim. Table prefix seems to be ok. If I change prefix to something else, wordpress starts running installation script (/wp-admin/install.php) – John Padiou Nov 21 '19 at 9:52
  • Interesting, I had the same problem and that's what fixed it for me. I'll keep looking for answer for you. – STEAMworks Learning Center Nov 21 '19 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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