Wordpress on a local machine redirecting to online url

i've downloaded a wordpress web to my local machine and tried setting it up. the problem: when trying to login, wordpress will always redirect to the online url. the only way i found was changing the siteurl manually in phpmyadmin to my local machine's ip address. is there a better solution? the problem about doing that is that permalinks won't work anymore locally.

thanks

Topic local-installation Wordpress

Category Web


Open up your wp-config.php file

Try adding the following to it:

define( 'WP_SITEURL', 'http://localhost/your_wordpress_folder' );  
define( 'WP_HOME',    'http://localhost/your_wordpress_folder' );

If I understand right you had restored backup of live site to local installation?

Basically you have two ways to handle it:

  1. Change site URL (I recommend RELOCATE way, always works nicely for me).

  2. Use hosts file of your OS to point live domain at your local IP (127.0.0.1).

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.