20 Set Domain Name In Localhost New

You can use hostname hostnamectl command to show or set the system s host name and dnsdomainname command to show the system s dns domain name.
Set domain name in localhost. See the section in the red box in the image above. When called with one argument or with the file option the commands set the host name or the nis yp domain name. 3 add lines containing the domain name s and ip address to redirect to.
If your custom domain name matches with an existing website your browser will open the localhost instead of the website while your local server is running. Change localhost to domain name in window ad your favorite domain name method two. Setting up a custom domain name instead of a localhost will help you when testing of many things such as redirecting a non www to a www website or vice versa or redirecting from http to https before publishing a website to the production hosting environment.
After having made this change you can access your local website with the google address. Preparing the website to launch on your browser. This technique is a little bit easier than method one.
Hostname uses the sethostname 2 function while all of the three domainname ypdomainname and nisdomainname use setdomainname 2. The dns server is thinking the web site joespizza in the com domain is being hosted by a web server with the ip address of 201 983 756 4 and forwards you to that location and before you know it you are looking at the web site for joe s pizza. You may only enter 1 name per line.
In ubuntu the local server by default is referred by the name localhost. To change your localhost to domain name all you need to do is run your wamp server and go to localhost page. This domain name server dns looks through all its domain name entries for joe s pizza.
Now you need to configure the home page for your custom domain. Now make the change in the hosts file as we did in 6 in case1. Note that this is effective only until the next reboot.