Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is the process for generating local subdomains using the hosts file:

  1. Open the hosts file: The hosts file is located in the etc directory in a Linux system or in C:\Windows\System32\drivers\etc\ on Windows.

  2. Add the IP address and domain name: In the hosts file, add a new line with the IP address and subdomain name you want to create. For example: 127.0.0.1 subdomain.example.com

  3. Save the hosts file: Once you added the subdomain, save the hosts file.

  4. Flush DNS cache: After you’ve made changes to the hosts file, flush your DNS cache to ensure your system caches the updated IP address.

  5. Test the subdomain: Open a web browser and enter the subdomain URL in the address bar. If everything is done correctly, the subdomain should now be accessible.