Short URLs

Last modified by Eleni Cojocariu on 2026/10/30 22:43

Explanation

A short URL is an XWiki URL without its xwiki, bin and view parts: server.com/Sandbox/WebHome instead of server.com/xwiki/bin/view/Sandbox/WebHome. Shortening them changes both the URLs XWiki accepts and the URLs it generates.

The three parts to remove

A default XWiki URL carries three removable parts, each removed by a different mechanism. They are independent, so you can remove one, two or all three.

PartExampleWhat it isHow to remove it
Application name/xwiki/The context path the servlet container gives the XWiki web application.Deploy XWiki as the Root Web Application
Servlet mapping/bin/The path the Action Servlet is mapped to, which tells the container which servlet handles the request.One of the two approaches below.
Action name/view/What to do with the document: view, edit, delete, and so on.Hide the View Action in URLs

Every configuration key these pages set is listed on URL Configuration Properties.

Removing the servlet mapping

This is the only part that configuration alone cannot remove. XWiki maps its Action Servlet to /bin/*, /wiki/* (the prefix of path-based subwikis), /testbin/* and /xwiki/*, so a request carrying none of them has to be rewritten into one of them before it reaches the servlet. Two places can do that, which is the choice to make:

What must not reach the Action Servlet

Whatever performs the rewriting has to leave alone the paths XWiki serves by other means, or it breaks static resources, the REST API and file uploads.

PathWhy it must be excluded
resources, skinsStatic resource types, which XWiki deliberately lets fall through to the servlet container's default servlet.
webjars, tmpResource types with their own handlers: web application libraries, and temporary resources such as generated diagrams.
restThe REST API, served by its own servlet.
redirectThe web application's welcome file, which sends a URL carrying no page to the home page.
bin, wiki, testbin, xwikiAlready mapped to the Action Servlet.
asyncrenderer, authenticate, jcaptcha, jobEach is claimed by another resource handler.
websocketThe prefix of the WebSocket end-points, which the realtime editing features connect to.
robots.txtServed as a static file when the instance provides one.

Why a single catch-all mapping is not enough

The obvious shortcut is to map the Action Servlet to /* in web.xml and change nothing else. It does not work: /skins and /resources match that mapping too, and web.xml leaves them unmapped precisely so that the container's default servlet serves them. Excluding them in the rewrite rules, or serving them from the web server in front of XWiki, is what the two approaches above do instead. Mapping the two paths to the container's own default servlet is not a way out either: on Tomcat that servlet takes no parameter for changing the directory it serves from, so you would have to write one of your own.

What you end up with

URLPage shown
server.com/Sandbox/WebHomeSandbox.WebHome
server.com/Sandbox/Sandbox.WebHome
server.com/DocumentDocument.WebHome
server.com/Main.WebHome

FAQ

Will my existing URLs stop working?

The /bin/* mapping stays in place in every approach, so the long form keeps resolving. Removing the application name is the exception: once XWiki is deployed at the root context, a bookmark that still carries /xwiki/ no longer resolves, so keep a redirect for it if such bookmarks exist.

Can short URLs be configured from the administration interface?

No. Every change is made in a configuration file of the instance, and the instance has to be restarted for the change to take effect.

Do short URLs work with path-based subwikis?

Yes. The wiki prefix that carries path-based subwikis is excluded from the rewriting, so a subwiki keeps its /wiki/<name>/ prefix.

More

To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.

Related

Get Connected