'Website in wordpress redirects to old URL after migration [closed]

I had never done migrating a site on wordpress, I'll put step by step how I did, need to put the site on a new domain that are on the same server, so only the migrated files, the database is equal.

I copied all the files from the old wordpress to the new site folder, I had the following result on the new site: Home - The site carries the theme but a message appears: 404: PAGE OR FILE NOT FOUND. newsite/wp-admin/ - redirect to oldsite/wp-admin/

I have the option in the site administrator old put the new URL but I'm afraid I could never access. it can go?

Thanks.



Solution 1:[1]

I've solved my issue with my solution at No# 04 See below what I tried:

1- Make sure Database wp_option links are set

/* MySQL: */
update wp_options set option_value = 'http://example.com' where option_name = 'siteurl';
update wp_options set option_value = 'http://example.com' where option_name = 'home';

2- Additionally define url in wp-config.php file

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

3- Clear cache of from server

4- Clear your browser cache & history (Hurray!!! it solved my issue no redirection)

On Chrome, Navigate to chrome://settings/clearBrowserData and clear image and file cache.

Solution 2:[2]

I think i need to give my contribution! In case you are using Polylang with a dynamic IP, add define('PLL_CACHE_HOME_URL', false); in your wp-config.php and it will solve all your problems (redirection to the former url)!

Solution 3:[3]

define('WP_HOME','domain.com');
define('WP_SITEURL','domain.com'); 

This goes in your wp-config.php

Also, be sure to clear your cache and use this script to replace ALL urls in your database.

https://github.com/interconnectit/Search-Replace-DB

Solution 4:[4]

If this setting not work: define('WP_HOME','domain.com'); define('WP_SITEURL','domain.com');

Try a new browser and clear cache. or try to disable all plugins and check if it working.

Mine worked after i removed cache.

Solution 5:[5]

My redirection issue was due to caching. If you do not want to have to clear all your cache and you are using Chrome:

Right click anywhere on the page > inpect element > Network tab > tick disable cache. Then in that same Chrome tab try to load your website again.

Solution 6:[6]

STILL if nothing works

GOTO : www.yoursiteurl.com/wp-admin
['YES' IT WILL OPEN , if you have migrated correctly]

GOTO : Settings => General Tab =>

you will see two fields their

  1. Wordpress Address URL - Enter your site URL
  2. Site Address URL - Enter your site URL

Make URLs same in Both fields SAVE changes

Enter your site URL in browser clear cache and reload Yeahhh.... Worked for me

Enjoy

Dont forget to modify WP_Options table with your site URL details. Take care my site

Solution 7:[7]

Disabling the plugins folder worked for me.

It was one of the redirection plugins that allowed only logged-in visitors to view the shop pages that was the culprit.

Solution 8:[8]

I solved a problem like my wp-admin was redirecting to the previous domain whenever I log in after migration of the wordpress website. To solve this problem follow these steps:

It is Simple

  1. Access your PHPMyAdmin database
  2. Check all tables
  3. Replace all irrelevant URL's with your current website URL's
  4. Done

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark
Solution 2 appersiano
Solution 3 Pancho
Solution 4 Jakir Hossain
Solution 5 Yannickv
Solution 6 M Ali Imtiaz
Solution 7 burf
Solution 8 Raja Sikandar