Defining pretty URL for accessing and configuring a Mashup UI page is a very common use case for business-focused Apps and eCommerce.
For example, we want to rewrite the URL: http://www.mysite.com/mashup-ui/page/search?type=clothes&products=shirts to map it to a specific product refinement on the /products page and get a cleaner URL like: http://www.mysite.com/products/clothes/shirt
Important: The rewriting rules you define take precedence on the default Mashup UI behavior and may lead to errors. For example, some widgets allow exporting data through the service http://www.mysite.com/export. If your rule rewrites all pages to http://www.mysite.com/<PAGENAME>, requests for /export will redirect to a page called export instead of the export service. To prevent this, you should set exception rules to redirect requests to the correct service.
1. In the <DATADIR>/webapps/360-mashup-ui/WEB-INF/ directory, edit the WEB-INF/urlrewrite.xml file.
2. Uncomment the content of the urlrewrite node, and add/edit the rewriting rules as needed. For our example of /products/clothes/shirt we would have the following configuration.
<urlrewrite>
<!-- Services have the highest priority --> <rule enabled="true"> <name>Services</name> <from>^/(resources|fetch|alerting|export|utils|login|errors|lang|storage|logout |staging-builder|testProduction)(.*)?</from> <to last="true">/$1$2</to> </rule>
◦ First, all the services that can be called by the Mashup UI (export, alerting, storage, etc.) are processed. We make sure they will not be impacted by URL rewriting to avoid errors. We can then add filter rules for the URLs of the application pages.