UPDATE: I've added a 1 minute demonstration of this entire tutorial at the bottom of this blog.
There's a lot under the hood when it comes to Liferay, and even that is an understatement, but in my opinion there's one very useful feature that never gets enough play; virtual hosting. In Liferay, virtual hosting is a free, out-of-the-box feature used to host more than one domain name on the same IP address, like running www.a.com, www.b.com, and www.c.com all running on one copy of Liferay. Cool, right? So, let me show you how to set up virtual hosting on your machine, because it should only take 5 minutes.
First, setup your machine to force some domain names redirect to your local copy of Liferay. This step involves editing the hosts file on your machine, and it is only for testing purposes, so it won't actually change the way anyone else in the world sees these domains.
To do this in Windows, go to the %WINDIR%\System32\drivers\etc directory and open the hosts file in Notepad. To do this in Mac OS, go to the /etc directory and open the hosts file in TextEdit. If you're running Linux, well, you should already know how to do this. Once the file is opened, add the following entry on a new line:
Next, startup Liferay and test the new domain. Visiting http://localhost:8080/ should redirect you to http://localhost:8080/web/guest/ and you should see your local copy of Liferay.
Much the same, visiting http://www.alpha.com:8080/ should redirect you to http://www.alpha.com:8080/web/guest/, just like localhost.
Now it's time to map a new community to www.alpha.com. The first step is to add a new community, so go to the Control Panel, and from there go to the Portal > Communities page. At the top you'll see an Add button, click it and add a new community named Alpha.
Once the Alpha community has been created the second step is to go to Manage Pages by clicking the Actions button and selecting Manage Pages. You'll need to add at least one page to your new community, so add a new page named Home. Once this is done, click on the Settings tab. In settings, click on the Virtual Host tab and you will see an empty field labeled Public Virtual Host. Add the domain www.alpha.com here and click Save.
Now if you visit http://www.alpha.com:8080/ and you should see the Alpha community, without any pesky /web/guest in the URL.
That's it! Now you're using virtual hosting on your machine, and your website just lost ten pounds.
P.S: If you didn't notice, you can map any number of domains and even sub-domains (xyz.a.com) to your site, but as far as I can tell Liferay does not yet support multiple domain mapping on the same community or wildcards, which means I'll be bugging our developers for the next few weeks.