Configure Global URL Redirects
Scroll Viewport provides functionality for defining permanent and temporary redirects from one page to another. After reading this page, you should be able to maintain redirects.
Global redirects should only be used if a redirect cannot be handled with page redirects using Redirect macros.
Define a new redirect
Click the cog icon at top right of the screen and select General configuration.
The Confluence administration interface is displayed.In the Scroll Viewport section, click URL Redirects.
The URL Redirects Management is displayed. The page consists of a table, showing all currently active redirects:Click Create to define a new redirect.
The Create Redirect screen is displayed.Enter the following information:
Enter an Incoming URL. At this point, you have two options:
You can enter an absolute HTTP-address - In this case, the redirect will only be applied if a request matches this address exactly.
You can enter a path starting with "/" - Scroll Viewport will automatically prefix the path with your current Confluence baseUrl.
Select a Mode. To redirect a specific incoming-URL you can select the Literal Mode or if you wish to cover a larger range of incoming-URLs you can use the Glob Pattern or the Regular Expression mode which will allow you to use wildcard-characters in your incoming-URLs. (see next chapter for more information)
Enter the Target URL. It can either be an absolute or a path-based (starting with a "/").
In addition to that you can choose between different Redirect-Types. The following two redirect-types are available:
301 (Moved Permanently)
302 (Moved Temporarily)
Click Save for saving and activating the redirect.
After completion, the newly created redirect should be listed in the table.
Examples
Here are some examples for defining Incoming- and Target-URLs:
Absolute incoming URL:
Incoming URL = http://www.k15t.com/display/software
In case of using an absolute Incoming URL, the redirect is only applied if the requested URL is fully equal to the entered Incoming URL.
Path-based incoming and target URL:
Incoming URL = /software/scroll+versions
Target URL = /software/scroll-versions/documentation
In this case, Scroll Viewport automatically prefixes the paths with the Confluence base URL, so this is a short notation for absolute URLs.
Restricted viewport paths
When configuring the URL for a viewport, some viewport paths are not allowed, as they override an existing Confluence paths.
The following viewport paths are not allowed:
- /admin
- /ajax
- /display
- /download
- /images
- /includes
- /json
- /plugins
- /pages
- /label
- /jcaptcha
- /s
- /status
- /x
- /rest
- /spaces
- /styles
- /rpc
- /rest
/favicon.ico
/noop.jsp
/login.action
- /synchrony
- /synchrony-proxy
Using Glob Pattern and Regular Expressions in URLs
As previously mentioned, you can use a glob-patterns/regular expression for defining the Incoming URL. Regular expressions (Regex) and Glob patterns are patterns used to match character combinations in strings. This enables you to take care of many incoming URLs using only one global redirect.
To learn more about Glob and Regex, please refer to the following resources:
Please consider the following limitation for Regex-based redirects: No start-of-input or end-of-input matcher allowed.
Glob Pattern Examples
Example 1
Incoming URL = http://www.example.com/confluence/* Target URL = http://www.example.com/confluence/destination
In this case every URL which contains the base URL http://www.example.com/confluence will be redirected to path /destination.
Example 2
Incoming URL = http://www.example.com/confluence/redirect* Target URL = http://www.example.com/confluence/destination$1
This will redirect any URL ending with "http://www.example.com/confluence/redirect" with one character after it to the target URL.
When using Glob Pattern mode, you can pass URL query parameters through a redirect and adding the placeholder $1 to the end of the Target URL. The example above will redirect a request with a URL such as http://www.example.com/confluecne/redirect?parameter=b to http://www.example.com/confluecne/destination?parameter=b
Regex Examples
Example 1
Incoming URL = http://www.example.com/confluence/.* Target URL = http://www.example.com/confluence/destination
In this case every URL which contains the base url http://www.example.com/confluence will be redirected to path /destination.
Example 2
Incoming URL = http://www.example.com/confluence/.*/red(ai|i|ie)rect Target URL = http://www.example.com/confluence/test/target-url
This will select every URL which starts with red and only one of the words ai, i, or ie in the middle and rect at the end.
Example 3
Incoming URL = http://www.example.com/confluence/(.*)/(redire.*) Target URL = http://www.example.com/confluence/destination/$1/$2
As you see, the capture group has been defined in the target URL, then the redirect will be varied based on the incoming URL:
http://www.example.com/confluence/test/redirect1 will be redirected to http://www.example.com/confluence/destination/test/redirect1
http://www.example.com/confluence/test2/redirect2 will be redirected to http://www.example.com/confluence/destination/test2/redirect2
Trying to replace your old Viewport URL with a new one? Learn how to redirect all old links to the new Viewport with a regex redirect.