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