1

I downloaded a website from live to local. I want to run it. But when I open it on localhost, it redirects me to live url. I have made changed to DATABASE wp_options table and replaced live URL with my local url. But still it is not working. Please guide me.

  • Are you sure you changed both 'site_url' and 'home_url' ? – Ravi Shinde Jan 25 '17 at 12:25
  • in table option_name is home and siteurl not site_url and home_url – ammar habib Jan 25 '17 at 12:29
  • Yeah. Have you changed both? – Ravi Shinde Jan 25 '17 at 12:32
  • yes i have changed both..i give the local address inside the both options. but when i run it redirect the live site url – ammar habib Jan 25 '17 at 12:36
  • do you have an .htaccessfile? – RobBenz Jan 25 '17 at 16:08
1

1) Make sure the wp-config.php doesn't have multisite reference settings such as define("DOMAIN_CURRENT_SITE", "somesite.com" );. If it does, delete these settings

2) If you have updated siteurl and home settings in the *_options table to use local settings and it still doesn't work, then

3) Delete all themes but a basic one (twentytwelve, twentythirteen,...) and delete all plugins. In this way, you are running the Wordpress core functionality.

4) If that still doesn't work, clear the cache of your browser or try a different potent browser.

5) If all this doesn't work, you may be faced with a network configuration issue and I think it goes beyond the scope of this question ?

1

If you've updated the options in the dtabase and are still getting redirected.

You can also define both the WP_SITEURL and WP_HOME in your test wp-config.php

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

If you are on windows you can change your hosts file to point the url to the local host ip. A similar process on Mac. Either way you won't have to change the db as you will be changing your local hosts file to point that url back to the host machine. It's actually more convenient because there is no need to change the website at all.

(On mobile right now otherwise i would add detailed instructions on this add i keep a reference file at home for myself)

NOTE: some plugins may be affected by this. Notably (and not actually a plugin) is the search and replace tool from interconnectit.com.

UPDATE: (adding excerpt from my own notes)

Windows

1) add this line to the Windows Hosts file C:\WINDOWS\system32\drivers\etc\hosts

#BEGIN CUSTOM
127.0.0.1   yourwebsite.com
#END CUSTOM

MAC

1) add this line to the Apple Hosts file /private/etc/ (I use terminal command nano /etc/hosts)

#BEGIN CUSTOM
127.0.0.1   yourwebsite.com
#END CUSTOM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.