Legacy Knowledge Base
Published Jul. 2, 2025

How to change site URL prefix from /web/sitename to a custom one

Written By

Jorge Diaz

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • 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?

Environment

  • Liferay DXP 7.2
  • Liferay DXP 7.3

Resolution

To change your current site URL prefix: /web/sitename to a custom one (for example /level1/level2/level3) there are two steps:

  1. Remove the /web/sitename prefix
  2. 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: /level1/level2/level3/page1
  • Page 2: /level1/level2/level3/page2
  • Page 3: /level1/level2/level3/page3
  • etc.

 

You can change the friendly URL of a page from its configuration page

 

Did this article resolve your issue ?

Legacy Knowledge Base