October 13, 2020
Estimated Post Reading Time ~

Shortening of URL using etc/map

As most of the time in our project implementation, we somehow end up shortening the URL, So that the whole link or the path is not publicly available and also shorten URL looks pretty decent.

Let's start with the step-by-step setup of our shorten URL internal redirect URLs.

First of all, we get only the http folder inside /etc/map. So if we make any changes will only work in our local instances as most of the time our higher environments are https.

So, just verify your higher environments and make the changes.

1. Create an https (sling:Folder) under /etc/map, just parallel to the http.
2. Now create a node(sling:Mapping) under /etc/map/https.
3. We need to play around two properties now i.e. sling:Match and sling:InternalRedirect

sling:match: This is the string pattern that we will match the requested URI.
sling:internalRedirect: This is the string pattern where we want to target or redirect the requested URI.

Below is an example where I am loading a page without .html and removing /content/mycompany

Once you publish this configuration then we can see the changes getting reflecting in the publish instance.

Try using https. publish if you are setting up this etc mapping for the publish URLs.

Removing .html and Shortening


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.