Dispatcher Rewrite Rule | Community
Skip to main content
apolu
New Participant
November 27, 2017
Solved

Dispatcher Rewrite Rule

  • November 27, 2017
  • 2 replies
  • 5091 views

Hi All,

I need some assistance on rewrite rule to fulfill my requirement.

Here is my requirement.

i have dispatcher url  http://abc.com ,so when i hit a url by appending a content which is not in dispatcher/publish level

ex: if i hit  url http://abc.com/nocontent/test.html or http://abc.com/nocontent/test.txt​   or http://abc.com/nocontent/test.img  etc...this needs to go http://abc.com only

so my intention is whatever will append which not there it should redirect to home page like http://abc.com only...can someone please give me suggestion to achieve this on dispatcher

Thanks,

Amarnath.

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 Sh1ju

In the dispatcher, add following line of code

ErrorDocument 404 http://abc.com

Refer Custom Error Responses - Apache HTTP Server Version 2.4

In AEM ,copy /libs/sling/servlet/errorhandler/404.jsp to /apps/sling/servlet/errorhandler/404.jsp and apply redirect logic.

Refer Custom Error Handler Pages

2 replies

Sh1ju
Sh1juAccepted solution
New Participant
November 27, 2017

In the dispatcher, add following line of code

ErrorDocument 404 http://abc.com

Refer Custom Error Responses - Apache HTTP Server Version 2.4

In AEM ,copy /libs/sling/servlet/errorhandler/404.jsp to /apps/sling/servlet/errorhandler/404.jsp and apply redirect logic.

Refer Custom Error Handler Pages

ravindrareddydr
New Participant
November 27, 2017

HI Amarnath,

It may useful

Custom Error Handler Pages

1. in your 404.jsp , you can forward to your website

2. same you use rewrite rules to redirect to domain dispatcher, when 404

Thanks

Ravindra