Help with adding alias to URL

Enonic version: 6.6.0
OS: Windows 10

I need help to shorten URL path for scope of pages. For example, we need to shorten this: http://www.test.com/one/two/three to this one http://www.test.com/one/two inside of enonic. So all, relative URLs that lead on long URL should be rebuilt to shorten one.

Of course we could do smth like this:
mapping.z.host = localhost
mapping.z.source = http://www.test.com/one/two
mapping.z.target = http://www.test.com/one/two/three

And when we will go to http://www.test.com/one/two we will be shown pages that lies on http://www.test.com/one/two/three. But it’s useless since all relative URLs inside enonic still points at one/two/three(at the real path of content), and we can get to the /one/two only by doing a direct HTTP request.
So the only way I see it - is to change folders structure. But maybe there is exist other ways of doing it? Cause currently we have a nice folder structure and we wouldn’t like to change it.

You could do that using the error.js and responding the desired page/content with a status 200 instead of giving the error page…
We do something similar on the Norweigian Football’s first division. For example, if you go to this page:


on the bottom there’s the subscribe link (http://www.eliteserien.no/terminliste/subscribe) which does not matches any existing content and should give the Not found error, but as we have customized the error function, an ics file is downloaded.

For this purpose, I suggest you simply rename your structure. The best structure is what you want to expose. Using vhosts is a no-go, but consider using site mappings instead.