admin管理员组

文章数量:1406163

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.

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.

Share Improve this question edited Nov 24, 2019 at 11:03 MrWhite 3,8911 gold badge20 silver badges23 bronze badges asked Nov 21, 2019 at 8:42 John PadiouJohn Padiou 111 silver badge3 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 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/support/topic/cookie-error-site-not-letting-me-log-in/

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

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.

本文标签: htaccessCannot Access Admin Area After Migration