Change the Wiki Path Segment

Last modified by Eleni Cojocariu on 2026/10/20 17:57

Steps

In a path-based URL such as /xwiki/wiki/support/view/Main/WebHome the wiki segment is the fixed marker that tells XWiki to read the wiki from the path, and renaming it means changing three files rather than one.

  1. Set the new segment in WEB-INF/xwiki.properties:
    url.standard.multiwiki.wikiPathPrefix = site
  2. Set the same value in WEB-INF/xwiki.cfg:
    xwiki.virtual.usepath.servletpath=site

    The filter that rewrites form submissions reads this key and not the one above, so a page saved from a subwiki is sent to the wrong URL while only the first file is changed.

  3. Point the action servlet at the new segment in WEB-INF/web.xml, replacing the mapping that carries the old one:
    <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>/site/*</url-pattern>
    </servlet-mapping>

    The servlet container routes on this mapping alone, so without it every URL built with the new segment is answered with a 404.

  4. Replace the old segment in xwiki.authentication.logoutpage, further down WEB-INF/xwiki.cfg. The value is a pattern, and its third alternative is the path-based one:
    xwiki.authentication.logoutpage=(/|/[^/]+/|/site/[^/]+/)logout/*
    Warning

    Leaving this one behind is the trap of the procedure: nothing reports an error, but the logout URL of a subwiki stops matching the pattern, so it is served as an ordinary request and the user is never signed out.

  5. Restart XWiki. All three files are read once, at startup.
  6. Open a subwiki through the renamed segment and confirm that it answers, that its own links carry the new segment, and that logging out of it works:
    http://myfarm.example.org/xwiki/site/support/view/Main/WebHome

FAQ

Does this rename the bin part of the URL as well?

No. That segment is a separate setting, url.standard.entityPathPrefix, and renaming it is not part of this procedure.

Can the segment be removed instead of renamed?

No. The segment is what marks a URL as path-based in the first place, as Wiki URL Resolution sets out.

Does an existing farm keep working on the old segment?

No. The servlet mapping is what routes the segment, and there is one of them, so the old addresses stop resolving as soon as the instance restarts.

Related

Get Connected