Show last authors
author | version | line-number | content |
---|---|---|---|
1 | This tutorial will tell you how to tune your XWiki platform so that the URLs used and displayed are nice. | ||
2 | |||
3 | #info("A nice URL is an URL which is short and/or easy to memorize, e.g. containing only what is semantically pertinent. In the case of XWiki, it is an URL without the xwiki/bin/view parts.") | ||
4 | |||
5 | If you deploy XWiki as the ROOT app, you must also change in WEB-INF/web.xml the \<display-name\> parameter to the empty string, like: | ||
6 | |||
7 | \<display-name\>\</display-name\> | ||
8 | |||
9 | To get rid of /view/, in xwiki.cfg write | ||
10 | |||
11 | xwiki.showviewaction=\0 | ||
12 | |||
13 | To get rid of /bin/, for the moment you have to change web.xml in a | ||
14 | container-dependent way, so that you map the container's default servlet | ||
15 | to existing directories, like skins, yui, tinymce and wikieditor, copy | ||
16 | the /bin mapping to also be activated for / (copy, don't change, so that | ||
17 | /bin works, too), then add in xwiki.cfg | ||
18 | |||
19 | xwiki.defaultactionpath= | ||
20 | |||
21 | This will allow you to access documents with server.com/Space/Document, | ||
22 | server.com/Space/ (pointing to Space.WebHome), server.com/Document | ||
23 | (pointing to Main.Document), and server.com/ will show Main.WebHome | ||
24 | without needing a redirect. | ||
25 | |||
26 | As a bonus, these changes are backwards compatible, meaning that any | ||
27 | currently working URL will also work with these changes performed, so | ||
28 | you won't have any broken bookmarks. | ||
29 | |||
30 | All these changes aren't completely tested, so there could be some | ||
31 | things that aren't working, because of code that parses the URL and | ||
32 | counts the number of slashes, or expects an exact URL pattern containing | ||
33 | /bin/ or stuff like that. But my unconfirmed guess is that it should all | ||
34 | work fine. | ||
35 | |||
36 | If you want to have different action mappings, like | ||
37 | server.com/Space/Doc?action=edit, then there's more work, like writing a | ||
38 | new URLFactory, changing struts-config.xml, and creating another | ||
39 | RequestProcessor. |