Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
HTML Wrap | ||||
---|---|---|---|---|
| ||||
Related topics: |
Virtual URI mapping is a way to redirect an incoming request to the actual location of the content. Typically the virtual address does not match the site hierarchy exactly.
...
The URIs can be either absolute or relative within the web application in which case the context path is added automatically. For example:
Info |
---|
It's important to keep in mind the placement of the virtualURIFilter in the chain. The filter acts on the current URI at the time of execution. Any selectors removed from the current URI before the filter executes cannot be configured in |
fromUri: /winter2016
toUri: forward:/marketing/
RelativefromUri: /winter2016
toUri: forward:/marketing/campaigns/winter2016
fromUri: /winter2016
toUri: forward:https://www.example.com/marketing/campaigns/winter2016.html
...
The mappings are delegated to a separate module ( virtual-uri
) through the info.magnolia.virtualuri.VirtualUriFilter
class and are stored in their own registry ( VirtualUriRegistry
), which allows to reference each mapping also in YAML definition files. All virtual URI mappings can be located via the Definitions app no matter whether they come from JCR or a YAML file:
You can also check the mappings in the About app's Virtual URI Mappings tab, or by searching Alternatively, search the config
space with the JCR browser app:
...
info.magnolia.virtualuri.mapping.*
Javadoc resource link | ||||
---|---|---|---|---|
|
.
), it is not taken as a wildcard anymore but the dot in fact is interpreted as dot. If you need a wildcard, use ?
instead.Javadoc resource link | ||||
---|---|---|---|---|
|
toUri
can contain back references to the regexp matches.Javadoc resource link | ||||
---|---|---|---|---|
|
RegexpVirtualUriMapping
that allows rotation between different destination URIs. In order to rotate, toUri
must contain an asterisk character *
that will be replaced by a random integer between start
(default is 1) and end
minus one (default is 3
). An additional property padding
specifies the desired width of the string. Zeroes are added to the left of the integer to make all strings equally wide. Default width is 2
.Javadoc resource link | ||||
---|---|---|---|---|
|
Javadoc resource link | ||||
---|---|---|---|---|
|
info.magnolia.module.googlesitemap.config.mapping.*
Javadoc resource link | ||||
---|---|---|---|---|
|
googleSitemaps
workspace and prepends the prefix.info.magnolia.multisite.mapping.*
Javadoc resource link | ||||
---|---|---|---|---|
|
null
. Javadoc resource link | ||||
---|---|---|---|---|
|
You You can also write your own implementation.
The patterns for regular expressions in the regex-based classes are defined in java.util.regex.Pattern .
Anchor | |||
---|---|---|---|
Anchor | |||
|
...
Advanced Tables - Table Plus | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
|
Take requested page name and pass it as a productId
request parameter to a product detail page.
Info | ||
---|---|---|
| ||
Always test your regex-based virtual URI configurations thoroughly before applying them to a live environment. The configurations that seem correct on the surface can yield unwanted results. For example, using boundary matchers (the hat |
Take requested page name and pass it as a productId
request parameter to a product detail page.
Advanced Tables - Table Plus | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
Advanced Tables - Table Plus | |||||||||||||||||
| |||||||||||||||||
|
The pattern [0-9a-9AzA-Z-]
in fromUri
means "any single character in the range of 0-9 9 or a-z or A-Z or the character -
literally". The plus character makes this a greedy pattern that matches one or more of the preceding token, and will match as many characters as possible before satisfying the next token. By enclosing the pattern in parentheses we create a capturing group ([0-9a-9AzA-Z-]+])
which can be referenced in the toUri
using $1
.
...
Advanced Tables - Table Plus | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||
|
Anchor | ||||
---|---|---|---|---|
|
The mapping redirects the requests for sitemaps to the /sitemaps
node. The configuration is taken from the google-sitemap
module in the default installation of Magnolia:
Advanced Tables - Table Plus | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
info.magnolia.module.googlesitemap.config.mapping.SiteMapVirtualUriMapping
redirect:/sitemaps |
Properties:
|
|
...
googleSitemaps workspace and prepends the prefix. | ||||
| Prefix prepended by the class. |
...
Mgnl p |
---|
...
Module | Edition | Mapping class | From (Site) | To |
---|---|---|---|---|
(Author Instance) | EE |
| / | redirect:/.magnolia/admincentral |
(Author Instance) | CE |
| / | redirect:/.magnolia/admincentral |
(Public Instance) | EE |
| / | redirect:/travel.html |
(Public Instance) | CE |
| / | redirect:/travel.html |
google-sitemap | CE, EE |
| redirect:/sitemaps | |
rssaggregator | CE, EE |
| /rssFeeds/(.*) | redirect:/rss/?feedPath=/$1 |
rssaggregator | CE, EE |
| /planetFeeds/(.*) | redirect:/rss/?feedPath=/$1&generatorName=planet |
rssaggregator | CE, EE |
|
| redirect:/rss/?generatorName=category&categories=$1&siteRoot=/$2 |
tours | CE |
|
| forward:/travel/tour?tour=$1 |
tours | EE |
|
( | forward:/tour?tour=$1 |
tours | EE |
|
( |
|