WordPress localhost site redirect to live site

I have download the code and export the database from server and setup the site on my localhost also I have been changed

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.

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.

Share Improve this question edited Apr 18, 2017 at 10:35 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Apr 18, 2017 at 6:37 Israr MansuriIsrar Mansuri 1791 gold badge1 silver badge6 bronze badges 4
  • Did you check your menu links or if the links are hard coded? – Aniruddha Gawade Commented Apr 18, 2017 at 6:49
  • Yes I have checked its not static – Israr Mansuri Commented Apr 18, 2017 at 6:53
  • 1 Check htaccess for any redirect rules to live site – Aniruddha Gawade Commented Apr 18, 2017 at 7:17
  • there was no .htacces I have put the htaccess but not working – Israr Mansuri Commented Apr 18, 2017 at 7:18
Add a comment  | 

7 Answers 7

Reset to default 14

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

    • In Chrome, you can try to clear your DNS cache before clearing all your cache

According to the wordpress reference here

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

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

OR

Edit functions.php

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

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

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

Hope this help!!

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/' );

to

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

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

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

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

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

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.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744698237a4588624.html

相关推荐

  • WordPress localhost site redirect to live site

    I have download the code and export the database from server and setup the site on my localhost also I have been changed

    21小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信