Moved my wordpress site from hosting to localhost, redirects to my site on the Internet. I understand it is necessary somewhere to register instead of the address of my site from the Internet to the address of the site on localhost. Tell me which document is responsible for this.

  • one
    As far as I remember these settings in WP in the database, in such cases I changed hands. But we still have to watch . Htaccess, of course - korytoff

3 answers 3

It is necessary to make changes in the database, below is the replacement script, but not the silver bullet, as if you need to write a php script in the meta data that will replace the url because serialization is used

UPDATE wp_posts SET post_content = REPLACE(post_content, 'z-site.ru', 'localhost'); UPDATE wp_posts SET guid = REPLACE(guid, 'z-site.ru', 'localhost'); UPDATE wp_options SET option_value = REPLACE(option_value, 'z-site.ru', 'localhost'); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'z-site.ru', 'localhost'); 

    Find and replace the address in the file WordPress database. Or edit the hosts file in windows.

      If I'm not mistaken, it answers .htaccess, change

       RewriteRule (.*) http://example.com/$1 [R=301,L] 

      On

       RewriteRule (.*) http://localhost/$1 [R=301,L] 
      • You are mistaken. And in this case, it can generally push the browser into a dead cycle of redirects. - newman