Hello all,
Scenario: https://www.domain.com/content/en-us/we-retail/men.html
In the above URL if I add (.) before men, then the content on the page is https://www.domain.com/content/en-us/we-retail.html
but the URL is still remaining as https://www.domain.com/content/en-us/we-retail/.men.html
Please suggest how I can block the URL with (/.) before men, so that it will show up the 404 error.
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
As part of the Resource Resolution step, the client request URI is decomposed into the following parts:
In your case when you are requesting for https://www.domain.com/content/en-us/we-retail/.men.html Sling resolution happens and it finds /content/en-us/we-retail as the Resource Path and men is considered as the selector. So it serves the content of we-retail resource with 200 status without changing the URL. This is the default behaviour of sling and cannot be blocked at either author/publish instance.
You will need to apply apache redirects at the dispatcher to return 404 in this case. Please see the below redirect rule which will take care of the use case:
RewriteCond %{REQUEST_URI} (.*)\/\.(.*)\.html
RewriteRule (.*) - [R=404,L]
For details regarding Sling Resolution please refer the below article:
https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html
Hope this helps!
Thanks!
As part of the Resource Resolution step, the client request URI is decomposed into the following parts:
In your case when you are requesting for https://www.domain.com/content/en-us/we-retail/.men.html Sling resolution happens and it finds /content/en-us/we-retail as the Resource Path and men is considered as the selector. So it serves the content of we-retail resource with 200 status without changing the URL. This is the default behaviour of sling and cannot be blocked at either author/publish instance.
You will need to apply apache redirects at the dispatcher to return 404 in this case. Please see the below redirect rule which will take care of the use case:
RewriteCond %{REQUEST_URI} (.*)\/\.(.*)\.html
RewriteRule (.*) - [R=404,L]
For details regarding Sling Resolution please refer the below article:
https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html
Hope this helps!
Thanks!
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies