I have download the code and export the database from server and setup the site on my localhost also I have been changed the home and site URL in wp_options table I am able to login at wp-admin but when I am clicking on the home page it redirect me to live site.

If anyone know the issue please help me.

Thanks in Advance.

  • Did you check your menu links or if the links are hard coded? – Aniruddha Gawade Apr 18 '17 at 6:49
  • Yes I have checked its not static – Israr Mansuri Apr 18 '17 at 6:53
  • 1
    Check htaccess for any redirect rules to live site – Aniruddha Gawade Apr 18 '17 at 7:17
  • there was no .htacces I have put the htaccess but not working – Israr Mansuri Apr 18 '17 at 7:18

Try following

  • If there are caching plugins installed like W3 total cache. Then purge cache first. Or may be disable them for time being

  • Perform Search and Replace in the database for Old Site URL. You can Use this Plugin

  • Reset Permalinks ( Dashboard >> Settings >> Permalinks )

  • Last but not the least. Clear your browser Cache and History

| improve this answer | |
  • 1
    I have already done this and this works for me. Thanks – Israr Mansuri Apr 18 '17 at 7:35
  • 1
    The Last option works for me :) – Javad Yousefi Feb 4 '18 at 21:33
  • Last worked for me too - still don't get why that would happen!? :( – Julix Jun 21 '18 at 18:04
  • 1
    Glad it helped you. :) – JItendra Rana Jun 23 '18 at 11:17
  • I have tested and confirmed: in my case it was the browser's cache. I had done all previous steps to no avail and then moved to another browser to check. Done. It was cache. – marquito Jan 14 '19 at 21:29

According to the wordpress reference here

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.



Edit functions.php

Add these two lines to the file, immediately after the initial "

update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

Or check the .htaccess file as well if added any rewrite rule for redirect the website.

Hope this help!!

| improve this answer | |
  • So, it's working or not? – mageDev0688 Apr 18 '17 at 7:15
  • not working but when I changed the permalink structure and then change back it to old one its working. – Israr Mansuri Apr 18 '17 at 7:17
  • Great dude you have solved!!! – mageDev0688 Apr 18 '17 at 7:20

you can change live url to local url directly in database table wp_options two option_name field

1) siteurl
2) home

After this save permalink.

Hope is useful

| improve this answer | |
  • I have changed it already – Israr Mansuri Apr 18 '17 at 7:14

Had to change these lines in my wp-config.php from

define('WP_CACHE', true);
define( 'WPCACHEHOME', 'C:\wamp64\www\wp-content\plugins\wp-super-cache/' );


define('WP_CACHE', false);
//define( 'WPCACHEHOME', 'C:\wamp64\www\wp-content\plugins\wp-super-cache/' );
| improve this answer | |

You can also solve this problem by installing WP cli and running :

wp search-replace 'example.com' 'example.local'

Check the codex for more info. But as JItendra said, it's important to clear the browser cache too after doing this.

| improve this answer | |

Try remove any redirecting plugins if you have in your live site codebase. I solved the same issue by removing the "safe-redirect-manager" plugin in local.

| improve this answer | |

I just change my permalink structure to plain and again to old one then Its working. thanks all of you for your help. :)

| improve this answer | |

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.