Posts

Showing posts with the label sitecoreseries

Displaying Custom 404 error page for urls with unallowed file extension in sitecore

Hey , there! Welcome to "Sitecore Series" Post is all about displaying custom 404 page for unallowed file extension requests. In Sitecore, we have an option to allow required file extensions and only the allowed file extensions are processed by Sitecore. (Not Sure? How to configure file extensions? Refer my previous post on allowing or blocking specific file extensions in Sitecore) When the custom 404 page is configured, Sitecore will process the URL and maps it with the associated file in webroot or item in Sitecore and displays it. If the file/item is not available, then it will display a custom 404 page. In case of unallowed file extensions, Sitecore will not process the request. Request is directly handled by IIS and redirects to default error page. Oh no! user is seeing default error page, not a good user experience.  Want to know how to configure a custom error page in this scenario? Yeah, this post is for you.   Refer below for the solution: Existing custom 404 page c...

Handling URL requests with different file extensions in Sitecore

Hey   there! Welcome to "Sitecore Series" Post is all about handling URL requests with different file extensions in Sitecore.  In Sitecore, we usually add presentation in items, but what if we want the data to be displayed from the files added in webroot with .txt, .html or any other extensions?  Example Scenarios: 1) Displaying a security file (mysitedomainurl/security.txt) 2) Loading a custom 404 page instead of default error page when the request is handled by IIS (mysitedomainurl/404.aspx or mysitedomainurl/404.html) Here is the solution for different scenarios: Allowing specific extensions : Apply patch by adding required extensions as below: <processor type= "Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel"> <param desc="Allowed extensions (comma seperated)">.txt, .html</param> </processor> Allowing all extensions: <processor type= "Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensi...