Last modified by Eleni Cojocariu on 2026/11/16 18:40

Hide last authors
Eleni Cojocariu 5.2 1 Make Apache HTTP Server rewrite the path in front of XWiki so that URLs stop carrying the ##/bin/## servlet mapping, the approach to take when the instance is already behind Apache, as described in [[Short URLs>>doc:documentation.xs.admin.urls.short-urls.WebHome]].
Eleni Cojocariu 2.1 2
3 1. Serve ##/skins## and ##/resources## from Apache so that they never reach the servlet container, pointing the aliases at your own exploded XWiki web application (##webapps/ROOT## on Tomcat).(((
4 {{code language="apache"}}
5 Alias /skins /usr/local/xwiki/skins
6 Alias /resources /usr/local/xwiki/resources
7
8 RewriteEngine on
9
10 RewriteRule ^/+skins - [L]
11 RewriteRule ^/+resources($|/.*) - [L]
12 {{/code}}
13 )))
14 1. Proxy every other request to XWiki, replacing ##localhost:8080## with your own servlet container address.(((
15 {{code language="apache"}}
16 ## The container redirects the browser for "/", so proxy it straight to the home page instead.
17 RewriteRule ^/*$ http://localhost:8080/Main/ [P,L]
18 ## Everything else goes to the servlet container.
19 RewriteRule .* http://localhost:8080%{REQUEST_URI} [P,L]
20
21 ProxyPassReverse / http://localhost:8080/
22 {{/code}}
23 )))
24 1. Map the ##action## servlet to ##/*## in ##WEB-INF/web.xml##.(((
25 {{code language="xml"}}
26 <servlet-mapping>
27 <servlet-name>action</servlet-name>
28 <url-pattern>/*</url-pattern>
29 </servlet-mapping>
30 {{/code}}
31 )))
Eleni Cojocariu 5.4 32 1. Set ##xwiki.defaultservletpath## to an empty value in ##xwiki.cfg##, the key described with its ##xwiki.properties## counterpart on [[URL Configuration Properties>>doc:documentation.xs.admin.urls.short-urls.properties.WebHome]].(((
Eleni Cojocariu 2.1 33 {{code language="none"}}
34 xwiki.defaultservletpath=
35 {{/code}}
36 )))
37 1. Restart Apache and XWiki.
38 1. Open any page and read its URL. The servlet mapping is gone, and the home page is reached without a redirect the browser can see.(((
39 {{code language="none"}}
40 before http://server.com/bin/view/Sandbox/WebHome
41 after http://server.com/view/Sandbox/WebHome
42 after http://server.com/ shows Main.WebHome
43 {{/code}}
44 )))

Get Connected