URL is redirecting to old domain after restoring a Wordpress backup due to Redis

I made a backup of a Wordpress site that has url abc.com using the Duplicator plugin. I then created a new website within CyberPanel on the same server that points to a different domain, xyz.com. With a default WP + LS Cache install, the URL for xyz.com works fine. However, after installing the backup of the original site, it is redirecting to the original URL, abc.com and any activity on the site is reflected in the abc.com database.

The Duplicator log shows that it correctly replaced any references to abc.com with xyz.com.

The DNS is with Cloudflare and doesn’t say anything about abc.com.

Interestingly, staging.xyz.com does not redirect and loads the original WP + LS Cache site that was cloned before restoring the backup.

What might the problem be?

Thanks!

Because the setting domain name still using abc.com

ref:
wordpress-address-site-address.png (680×230) (wpbeginner.com)
How to Change Your WordPress Site URLs (Step by Step) (wpbeginner.com)

this is what i do if i need to clone or change domain name for wp
i use this : All-in-One WP Migration – WordPress plugin | WordPress.org

create backup from wp
download the backup

install wp on new server
install plugin
upload the backup

done

Thanks, but Duplicator has worked for me probably 100 times. I have also checked in the database and the siteurl is set to xyz.com

I’ll give AIO WP Migraiton a try though.

1 Like

well different chef, different ingredients and none is wrong

if:

have you try to using manual defined from wp-config ?

wp-config is fine

i mean try this
define( 'WP_HOME' , 'https://example.com' );
define( 'WP_SITEURL' , 'https://example.com' );
ref: How to Change Your WordPress Site URLs (Step by Step) (wpbeginner.com)

if after u use define from wp-config then everything is going well
then something happen when you do migration…
php version?
permission?
sql?
etc etc etc

Thanks very much. I just tried defining the url in wp-config and it doesn’t help.

I successfully installed the backup on a new server with the same domain xyz.com and with the same backup files. Yet, when I make a backup of THAT site and put it on def.com on the same server, I get the same issue - going to def.com redirects to xyz.com, so clearly there is some conflict with my actual server/cyberpanel (which I can’t easily change/replace for various reasons) and the migration.

If anyone has suggestions of what to check specifically (php, sql, permissions, etc…) and how to do so, it would be appreciated.

I just deleted the xyz.com website from the new server and now it 301 redirects me to example.com when I try to go to def.com.

how about your wp-config.php ? can you paste here ? the db server localhost or using IP ?

Please show me the site url from the database table wp-options

1 Like

my guess /… he was using sql server with ip public not using localhost or 127.0.0.1 if like he said before

They’re using define(‘DB_HOST’, “localhost:3306”)

I assure you the siteurl matches the new domains. I’ve tested this on a new server and the problem persists.

It seems to have something to do with the specific site that I’m cloning, and presumably the database. When I use Duplicator to copy a stock WP site on the same server, I don’t get these problems.

Fortunately my site isn’t live, so I’m going to try rebuilding it from scratch today - fresh OS and cyberpanel install, config server packages, install fresh wp site, copy all the plugin and theme folders and let it create a new database. I want to move hosts anyway, so its a decent opportunity to get set up better

:frowning:
i cant help you my friend :frowning:

Thanks anyway!

I think I’ve isolated the issue to Redis. I hadn’t appropriately updated the connection details in WP-config so the new site was loading cached files from the old site. I forget how to properly configure it, so am currently refreshing my memory. But the problem goes away when I stop the redis service via SSH.

Interestingly, I was getting success today by adding

`define( ` `'WP_HOME'` `, ` `'https://example.com'` `);`
`define( ` `'WP_SITEURL'` `, ` `'https://example.com'` `);`

to wp-config. I’m not sure why it wasn’t working previously.

Anyway, when I get this fully diagnosed and fixed, I’ll update this topic. Thanks again for your help

I solved this now.

  1. I updated the authentication keys and salts in wp-config using the link provided there (which I had previously ignored). This wasn’t the issue, but needed to be done anyway. https://api.wordpress.org/secret-key/1.1/salt/
  2. I changed the WP_CACHE_KEY_SALT from the gibberish salt key that was there already to the domain name of the site. This should allow for future Duplicator migrations to change it automatically. If not, at least it will be clear that it needs to change and to do so.

I’ll also leave this here for others’ reference. If you are using the Redis Object Cache plugin, here are is the documentaiton for the connection parameters that need to be entered in wp-config. Specifically it is useful to set up and change the password.
Connection Parameters · rhubarbgroup/redis-cache Wiki (github.com)

I also recommend these articles for setting up redis:

How To Install and Secure Redis on Ubuntu 20.04 | DigitalOcean

I left bind unused (commented-out) so that I could connect RedisInsight from my/any desktop. To be secure, I set a very long password.

How To Configure Redis Caching to Speed Up WordPress on Ubuntu 14.04 | DigitalOcean

1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.