Question

I had a website which it’s domain is expired: https://mrafiee.net I also have another active domain and website: https://rafiee.net

I have created a subdomain under my active domain: https://old.rafiee.net I copied all content in mrafiee.net foolder (which is an add-on domain in my cpanel) in my host, to old.rafiee.net folder.

I expected to reach my website when I go to https://old.rafiee.net, but it redirects me to https://mrafiee.net which is already expired.

I would be very grateful if someone can help me to solve this issue. Thansk

Was it helpful?

Solution

This is because the database stores information about the old domain.

Open the database in phpmyadmin and run this query. The code will replace the old domain with the new one.

UPDATE wp_options SET option_value = replace(option_value, 'https://mrafiee.net', 'https://old.rafiee.net') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'https://mrafiee.net','https://old.rafiee.net');
UPDATE wp_posts SET post_content = replace(post_content, 'https://mrafiee.net', 'https://old.rafiee.net');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://mrafiee.net','https://old.rafiee.net');
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top