Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website in wordpress redirects to old URL after migration

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.

like image 499
cristiano matos Avatar asked Nov 21 '13 13:11

cristiano matos


People also ask

How do I redirect an old URL to a new URL in WordPress?

Go to WP-Admin Dashboard > Settings > 301 Redirects > Enter the old URL under 'Requests' and the new URL under 'Destination' > Save Changes.

Why is my WordPress site redirecting to another site?

What does WordPress hacked redirect mean? WordPress hacked redirect happens when malicious code is injected into your website, which then automatically takes your visitors to another website. Usually, the destination website is spammy, with grey market pharmaceutical products, or illegal services.


2 Answers

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.

like image 192
A.Aleem11 Avatar answered Oct 22 '22 16:10

A.Aleem11


You need to make a change to your database. In the database table wp_options (or whatever your database prefix is), you need to change two lines.

One should be option_id 1, option_name siteurl. Change the option_value from the old url to the new url.

Similarly there should also be option_id 36, option_name home. Change the option_value also from the old url to the new url.

This should do the trick. Also check out http://wp.smashingmagazine.com/2013/04/08/moving-wordpress-website/ for the best method to migrate.

Edit

In the comments Damon also mentions the issue with re-linking all the images. This for sure can be a right pain, but I suggest this plugin.

http://wordpress.org/plugins/search-and-replace/

Just search for the old url and replace with the new one. Before doing this though, make sure you have a backup of the database. You can never guarantee the results when using plugins to mess with your database. But this has always worked for me.

like image 42
The Humble Rat Avatar answered Oct 22 '22 17:10

The Humble Rat