I know that there is already a similar question like this. But I have already done all these suggested solution and nothing works for me.

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

    • I have already disabled any possible plugin that using cache or redirection ]
  • Perform Search and Replace in the database for Old Site URL. You can Use this Plugin .

    • I opened sql file and perform search and replace for the live url into my local url ]
  • Reset Permalinks ( Dashboard >> Settings >> Permalinks ).

    • I used wp cli to perform permalinks reset ]
  • Last but not the least. Clear your browser Cache and History

    • Always clearing my browser and even using incognito ]

When I deleted all the existing tables, wordpress asking me to setup new wordpress but when I put the tables back, still redirecting me to the live site. Any suggestion?


Look in your wp_options database table for the siteurl and home options and check these are using your local URL.

As Captain S commented, these can also be overridden in your wp-config:

define('WP_HOME', 'http://www.localsite.test');
define('WP_SITEURL', 'http://www.localsite.test');
  • Yes, when I did a search and replace of my sql file, these values on my database has been changed as well – bryanxkier Jan 11 '20 at 23:34
  • Can you please rename your plugins directory so that all plugins are disabled. Do you have any other rewrite rules in your htaccess or Apache vhost? – Alexander Holsgrove Jan 12 '20 at 0:04
  • Thanks @Alexander. I already figured out why. The one who made the project put a redirection code on the theme itself. – bryanxkier Jan 12 '20 at 2:43

check your wp-config.php if you have defined 'WP_HOME' and/or 'WP_SITEURL'. Setting these values will override the wp_options table values. If that doesn't help I recommend the tool database search and replace.

Hope that helps.

  • Yes, I have already defined this on my wp-config.php define('WP_CACHE', false); define('WP_HOME','local.test'); define('WP_SITEURL','local.test'); -- I'll try to use the tool you recommend. Thanks – bryanxkier Jan 11 '20 at 23:33
  • I've tried the tool and no luck, still redirecting me to the live url. And I have only a basic .htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/culinary/ RewriteRule . /index.php [L] </IfModule> # END WordPress I'm running out of options here. and so behind of the project. Could anyone help me with this please. Thanks in advance – bryanxkier Jan 12 '20 at 0:02

Solved. Someone put a redirection code on the theme itself


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