- Our Liferay web site has the following URL prefix: /web/sitename and its URLs are: http://example.com/web/sitename/mypage
- We want to change the URL prefix to: /level1/level2/level3 so its URLs are changed to: http://example.com/level1/level2/level3/mypage
- How can we change it?
- Liferay DXP 7.2
- Liferay DXP 7.3
To change your current site URL prefix: /web/sitename to a custom one (for example /level1/level2/level3) there are two steps:
- Remove the /web/sitename prefix
- Add the custom /level1/level2/level3 prefix
Removing the /web/sitename prefix of a site
As one Liferay can store several sites, the URL prefix /web/sitename is used by Liferay to find in which site you are currently located.
If you want to remove it, you can use a virtual host name at site level, and access to the site using this virtual host.
For more information see How to remove unnecessary parts from the URL / shorten URL / make URL friendlier article.
Adding a custom prefix to the URL site
If you want to add a custom prefix
/level1/level2/level3 prefix, it is not possible to configure this at site level.
As a workaround you can edit the friendly urls of every site page and add the custom prefix to all of them, so you will end having:
- Page 1:
- Page 2:
- Page 3:
You can change the friendly URL of a page from its configuration page