Virtual hosting is an important feature in Liferay that allows you to customize Liferay URLs to suit your needs. You may want to customize the URL for SEO reasons or user friendliness or you may just not like having that '/web/guest/home' in the URL.
What is the /web/guest/home for anyway?
First let us try to understand what it means. The name of the servlet that deals with incoming requests is the 'web' servlet and hence '/web/ is a mapping to that servlet. Obviously '/guest' maps to the 'Guest' community i.e. your public facing pages. And 'home' is the name of the page you are requesting within that community.
Remove /web/guest/home through Liferay Virtual Hosting
After you login as an administrator user, click on the 'Control Panel' under the dock.
Click on 'Communities' under the 'Portal' tab on the left hand side.
You should see the following page with all your communities.
Click on the actions button and select 'Manage Pages' for the community you want to setup Virtual Hosting for.
On the next page click on 'Settings'
Then select 'Virtual Hosting'
Enter the domain name for your website. For purposes of this How To document I added an entry in my local hosts file to get this working locally. On a public portal you would just enter www.mywebsite.com.
Save the new settings and go ahead and test it. You should now only see the name of the page after the URL.
This is really handy when it comes to search engine optimization since the URL of a page is really important and the '/web/guest/' component of it does not add any value to the URL, in fact it kind of dilutes your URL when it comes to search engines.
You can do this for your other communities as well. So if this were an organization portal, your members virtual host can be 'my.organization.org' and your staff can be 'staff.organization.org'.
Feel free to drop me a line and share this How To.