Redirects between main wiki/subwikis

Hi All,

I have found I can’t set a redirect from any wiki to any other wiki. using either of the options on this page.

I’ve also tried a few of the xwiki.cfg and xwiki.properties options here and have specifically specified both of the domains that I am tested between. We are using Domain based instead of Path based wikis and ShortURLs.

The redirects always point to the same wiki you are currently on, even when using absolute URLs.
e.g. from the sub wiki ‘test.wiki.domain.com.au’

$response.sendRedirect($xwiki.getURL('xwiki:TestPage.WebHome'))

or

$response.sendRedirect($xwiki.getURL('https://wiki.domain.com.au/TestPage/'))

both resolve too https://test.wiki.domain.com.au/TestPage/

Should redirects work between wikis?
And should they work with domain based wikis?

This is not correct for sure, see the first example on Redirect (Extension.Redirect) - XWiki. Try $response.sendRedirect('https://wiki.domain.com.au/TestPage/').

Sorry that’s was my bad. I did use the below when testing just didn’t pay enough attention when writing OP.

$response.sendRedirect('https://wiki.domain.com.au/TestPage/')

Thank you for responding though.

So this is not working? (even with the domain added in the whitelist config)

That’s correct. It seems to ignore the domain and only uses the path even when the other wiki domain has been added to url.trustedDomains in xwiki.properties. When it is specified it doesn’t show errors in the logs about an untrusted domain, it does show the error when it isn’t specified.

I’ve also tried url.trustedDomainsEnabled set to false, but it still uses the current wiki’s domain.

I haven’t tested setting a redirect to an address outside of our wiki yet. I’ll try that and come back.

Hi,

if you set this to false, then in theory there’s no operation performed on the given URL to do the redirection: it should follow blindly what you’ve put. Are you sure it’s not some kind of infra issue with this domain or URL?