rewrite seo url Developer Legacy

How to call the view of a node from the URL when SEO rules are applied on that node?

Question

The customer would like to call the view (default or non-default) of a node and SEO rule is applied to this node.

Answer

The first constraint is that a content template for each view has to be created.

The second constraint is that only one content template could be the default one.
This means that calling a node with the default view return the view of the default content template.

To bypass these constraints, a solution is to use your own SEO URL rewriting.

As mentioned in the documentation link, https://academy.jahia.com/documentation/techwiki/services/urls-management

you can define it as below:

- modules/**/META-INF/seo-urlrewrite*.xml

Here is a module to illustrate this SEO URL rewriting: https://support.jahia.com/secure/attachment/48493/test-7121-1.0-SNAPSHOT.jar
The rule is the following one seo-urlrewrite-test7121.xml:
 

<urlrewrite>
    <rule>
        <name>Append servername</name>
        <note>Check if we need to add server name</note>
        <from>^(.*)/titi/(.*)\.html$</from>
        <to>$1/home/pagecontent/$2\.html</to>
    </rule>
</urlrewrite>

This rule means that every URL containing /titi/[content template name].html is converted to /cms/render/live/en/sites/mySite/home/pagecontent/[content template name].html

In this module, a default content template "vuesimple" and a content template "details" are defined

So, when entering in Live mode: http://desktop-o9jivla:8080/titi/test.vuesimple.html or http://desktop-o9jivla:8080/titi/test.html, the SEO URL rewriting is applied and convert the URL to: /cms/render/live/en/sites/mySite/home/pagecontent/test.vuesimple.htm

And when entering in Live mode: http://desktop-o9jivla:8080/titi/test.details.html, the SEO URL rewriting is applied and convert the URL to: /cms/render/live/en/sites/mySite/home/pagecontent/test.details.html