Domain Name System (DNS) is a critical component of the Internet’s infrastructure that translates human-friendly names, such as rtcamp.com, into IP addresses. We assume that you are already familiar with this concept. If you would like to refresh your knowledge, you can visit howdns.works.
Once you have an understanding of how DNS works, you can manipulate the system to achieve various tasks. One of the most common uses is ‘DNS overriding’, which redirects a browser’s requests for a domain name to an IP address that you choose. This is typically accomplished by editing the /etc/hosts
file on your Linux machine. (Mac users may prefer to use the Gas Mask app).
For Windows, users can follow the following steps.
This manipulation of DNS is often used during website development to ensure that the browser loads the site from the development server rather than the live/production server.
There are a few disadvantages to this method such as:
/etc/hosts
file are limited to your local machine. When demonstrating to a client, you may need to ask them to update their own file. Since rtCamp works with large enterprises, where there are often a dozen people involved in checking the demo, this method is discouraged during client demos./etc/hosts
file does not support wildcard domains. While this is rarely a requirement during development, if you encounter a related issue, it may necessitate additional workarounds that are not worth the effort.Despite these disadvantages, hosts overrides have the advantage of not requiring the maintenance of a separate domain or address for the development site. This eliminates the need for a search-and-replace step for the site address. However, as search-and-replace is handled automatically during deployments, hosts file overrides are rarely used nowadays when working on a WordPress site.
By default, our personal computers use DNS resolvers provided by our Internet Service Providers (ISPs). These resolvers often prove to be unreliable, take longer to resolve addresses (even if they are geographically closer to our homes), raise privacy concerns, and may not resolve sites blocked by our ISPs at their discretion.
So in general, it is recommended you use 1.1.1.1 (and 1.0.0.1) DNS resolvers by Cloudflare on your personal computers. Another option is Google’s 8.8.8.8 and 8.8.4.4.
Local By Flywheel – LocalWP, is a convenient choice for building WordPress projects. Local WP even lets you use custom domain names with the ‘.local’ top-level domain. For instance, if your project is named ‘example,’ you can access it through ‘example.local’ in your web browser.
However, Local WP achieves this by adding entries to your local host files that direct to your computer’s IP address (localhost). It also adjusts or removes these entries when you delete a project.