Expand my Community achievements bar.

SOLVED

Dispatcher Rewrite Rule

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 4

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

View solution in original post

2 Replies

Avatar

Level 3

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

Avatar

Correct answer by
Level 4

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