I have enabled SDI for my header and footer components. I have configured a dispatcher for parsing it and added
AddOutputFilter INCLUDES .html
SetOutputFilter INCLUDES
AddOutputFilterByType INCLUDES text/html
but it does not work for some reasons.
Solved! Go to Solution.
We encountered a similar issue, even though we weren't using SDI. When we tried to access a URL like "/content/aem-demo/xyz.html," it correctly redirected to our custom 404 page as expected. However, when we tried to access the same URL without the ".html" extension, it unexpectedly redirected to a 403 (Forbidden) page without the header and footer.
You can find a detailed explanation of why we experienced the 403 error in the accepted answer on StackOverflow. https://stackoverflow.com/questions/48166989/why-aem-returns-403-for-requests-without-extensions
To resolve this issue, we implemented a rewrite rule that added the ".html" extension to the URL in such cases. After applying the rewrite rule, when we accessed a URL without the ".html" extension, it now redirected to .html page and displayed the expected 404 page for a not-found page, as desired.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1.html [R=301,L]
Redirect URLs that end with a trailing slash to URLs without the trailing slash and append ".html".
We encountered a similar issue, even though we weren't using SDI. When we tried to access a URL like "/content/aem-demo/xyz.html," it correctly redirected to our custom 404 page as expected. However, when we tried to access the same URL without the ".html" extension, it unexpectedly redirected to a 403 (Forbidden) page without the header and footer.
You can find a detailed explanation of why we experienced the 403 error in the accepted answer on StackOverflow. https://stackoverflow.com/questions/48166989/why-aem-returns-403-for-requests-without-extensions
To resolve this issue, we implemented a rewrite rule that added the ".html" extension to the URL in such cases. After applying the rewrite rule, when we accessed a URL without the ".html" extension, it now redirected to .html page and displayed the expected 404 page for a not-found page, as desired.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1.html [R=301,L]
Redirect URLs that end with a trailing slash to URLs without the trailing slash and append ".html".
Hi @Mahedi_Sabuj ,
Thanks for your response. We are using ACS AEM Commons error redirects and it is not redirecting to the URL with "/" at the end. It serves 404 pages from the same URL without changing it.
Not Tested but Worth Trying:
If you are using ACS AEM Commons error redirects, you need to configure it to redirect to the URL with the .html extension. To do this, open the ACS AEM Commons error redirects configuration and add the following line:
redirect-to-html-extension: true
This setting will ensure that all requests to non-existent pages are redirected to the corresponding request with the .html extension. Once you have configured ACS AEM Commons error redirects, restart the dispatcher.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies