• chkpt

    (@chkpt)


    Hi having an issue with a site where when we try to swap out the IP address to the domain the front end works fine but I can’t login to the backend as it has the following error.

    ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

    I tried this define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’] ); and it did not work.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • autotutorial

    (@autotutorial)

    change url

    //Trust HOST
    if(!($_SERVER['HTTP_HOST'] == 'myhost.com')) {
    //Trust IP for Trust HOST
    //Read if you have $_SERVER['SERVER_ADDRESS']
    if($_SERVER['REMOTE_ADRESS'] === '21.20.20.20') {
    define( 'WP_HOME', 'https://21.20.20.20' );
    define( 'WP_SITEURL', 'https://21.20.20.20' );
    }
    }

    if you use an ip other than localhost, then the inverse resolution of your hostname in this example myhost.com is ip 21.20.20.20. Replace myhost.com with your host and your ip referring to hostname

    the data in the database are stored with myhost.com and before executing a search and replace exclusively by plugins, make backups of your files and the database and test if with this code you can enter .. I’m not sure but since ip and hostname share the same storage memory and use the conditional (if of the first line of code) maybe you can view your photos myhost.com/uploads/ even when you use your ip ..

    Recommendation when using your ip do not change or add anything … do not touch pages or articles … otherwise in the database you will have the old data on myhost.com while the new ones on 21.20.20.20

    MKDan

    (@mkdan)

    I do face this issue sometimes. But it is easy to fix.

    Instead of visiting /wp-admin/, try to visit /wp-admin/widgets.php

    If the problem still persists, click the “lock” icon on the chrome browser > cookies > check whether anything blocked under the “blocked” tab.

    You can check the below video.
    https://www.youtube.com/watch?v=9XTa2dqQFt8

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Chaning from IP to domain causing cookie error’ is closed to new replies.