Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

ErrorDocument Retain Incorrect URL

Avatar

Community Advisor

Hi AEM Community, 

 

I am using the below Error Document directive for redirecting to custom error pages - 

 

ErrorDocument 404 /errors/404.html

 Currently the rule is working correctly but I have a requirement to retain the URL which the user entered.

 As this will help with user being able to correct the URL more promptly.

 

However, currently my URL also gets updated with the above.

 

I had read the below in a blog -

When you have absolute URL in ErrorDocument 404 it will perform full redirect. However using a relative URL will only do an internal rewrite to prevent URL changing in browser.

 

Am I missing any steps to have the user URL retained in my browser ?

 

Thanks in advance. Any inputs/help @kautuk_sahni , @arunpatidar ?

 

Best Regards,

Rohan Garg

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

If you are not explicitly redirecting then path stays the same

check the example image at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-dispatcher-errordocume... 



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi ,

This does not perform redirect

ErrorDocument 404 /errors/404.html

I think you have other rules which are doing 301/302 redirect, please check those rules.



Arun Patidar

Avatar

Community Advisor

@arunpatidar - The ErrorDocument is working fine as when no matching path is found in publish and it returns 404 to dispatcher this URL is picked up.

I wanted to know if there is a way to retain the original URL that the user entered.

Avatar

Correct answer by
Community Advisor

Hi,

If you are not explicitly redirecting then path stays the same

check the example image at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-dispatcher-errordocume... 



Arun Patidar