Here is the process for generating local subdomains using the hosts file:
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.
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
Save the hosts file: Once you added the subdomain, save the hosts file.
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.
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.
Asked: 2023-06-11 10:06:52 +0000
Seen: 11 times
Last updated: Jun 11 '23