How to remove years and months from the urls | Community
Skip to main content
August 8, 2019
Solved

How to remove years and months from the urls

  • August 8, 2019
  • 4 replies
  • 1455 views

We have a use case where we want to create the hierarchy in AEM author where the pages will be created under years and months but for the end-user, we don't want to display the years and months in the URLs.

Is this something that can be achieved via Apache and dispatcher rules?

Thanks,

Nikunj Jariwala

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by user05162

You can achieve this by using the mod_rewrite module of apache. Check [1] for more details.

[1] https://stackoverflow.com/questions/33037563/url-rewriting-with-dynamic-parameters

https://moz.com/blog/using-mod-rewrite-to-convert-dynamic-urls-to-seo-friendly-urls

4 replies

Adobe Employee
August 8, 2019

Hello,

You can achieve this by defining the rewrite rules on Apache together with sling mappings.

Please go through these links to get more information:

Resource Mapping

https://shinesolutions.com/2017/01/04/demystifying-shortened-and-extension-less-urls-in-aem/

How to configure link rewriting

https://www.aemquickstart.in/2019/01/url-shortening-in-aem.html

Regards,

Vishu

August 8, 2019

Thanks for replying Vish.dhaliwal​.

The set up works as expected when we have static paths like /content/site_name/en. My question is around the dynamic aspect of the path i.e. there will be many years and months pages in the hierarchy.

for example, the content in AEM will look like the following:

/content/site_name/en/news/articles/2019/07/news-article-1.html

/content/site_name/en/news/articles/2018/06/news-article-2.html

/content/site_name/en/news/articles/2015/04/news-article-3.html

The end-user should be able to access the pages using the following:

http://example.com/en/news/articles/news-article-1.html

http://example.com/en/news/articles/news-article-2.html

http://example.com/en/news/articles/news-article-3.html

Is there any way we can achieve this without writing any custom code in AEM? I m not sure if Apache rewrite can achieve this.

user05162Adobe EmployeeAccepted solution
Adobe Employee
August 8, 2019
August 8, 2019

Makes sense. Thanks JaideepBrar​ for the reference links.

Thanks,

Nikunj Jariwala