It’s rare to start a website from scratch. More often, a developer needs to install a local wordpress environment to work on an existing website. After setting up a virtual server on a local computer, and copying over the theme files and database, nearly everything is ready to test that the local setup works.
At this point, you’d expect the local url to lead to your local page, but quite often, your browser quickly redirects you to the production website instead. This is due to your database not yet being updated.
There are different places where the database needs updating. This also depends on the type of wordpress intallation: single, multisite with subdomains, or multisite with subdirectories.
The tables and field to change are listed in this post on “how to update urls in database after importing to local to solve redirection issues“. You do this directly in the Local database (not production) with myPhpAdmin, for instance. There aren’t so many places and fields.
When that’s done, you normally can access your local sites, local back-ends, and the links between them will mostly work.
The following might not redirect to local but still lead to production sites:
- widgets for which you’ve hard-coded the website link
- menu items, same situation
- plugins that aren’t necessarily well coded and create files with hard-coded links upon installation
The other types of redirections you might look into are:
- yoast SEO redirections, created automatically when you delete/rename a page
- server-side redirections that help people who make typos or link to defective urls. These are stored in configurations files on the server. For servers running Apache, these are usually .htaccess files whereas for nginx running servers it’s usually a file that ends with nginx.conf