General redirect question

We try to implement xwiki into our navision software by linking it with the “help-button”.
By standard this would generate a link to a helpserver with a special id at the end, according to the form the customer is using.

We are able to change the url of the helpserver, but we’re not able to deactivate the auto-generating of the id-number which results in urls like xwiki/bin/view/Main/23428947239

As these pages dont exist you get the standard answer of document cannot be found.
Is there any chance of redirecting this back to the mainpage?

I’m very unexperienced with this so i dont know if this has to be fixed by the server its running on or if there is a solution xwiki wise.

Glad if you can help,

Cheers,
Tom

Yes, you should be able to do that. If you check the web.xml of XWiki you should see:

  <error-page>
    <error-code>404</error-code>
    <location>/bin/view/Main/DocumentDoesNotExist</location>
  </error-page>

This means that you can edit this page and modify its content to do a redirect.

Actually there’s also a docdoesnotexist.vm template file that you could override through a custom skin. But it’s more involved. I’d recommend creating or editing the Main.DocumentDoesNotExist page.

Another option is to use this UI Extension Point to customize the content of the page not found UI: https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/Document%20Does%20Not%20Exist/

See https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HCustomizingerrorpages

See https://www.xwiki.org/xwiki/bin/view/FAQ/Adding%20a%20redirect