I found some posts about this, but I'm not sure my scenario is the same.
My main issue is that nodes in my Umbraco render with the alternative templates url syntax (i.e. http://hostname.com/TemplateAlias) for templates are NOT allowed for the node.
A practical example:
the Home node has got only one Allowed template with alias "home".
Another template exists with the alias "location".
If I type something like http://hostname.com/location the home page is rendered and the HTTP response code is 200.
So from a SEO point of view the page http://hostname.com/location exists and it's a duplication of the home page (which to me it's a double mistake).
What I would expect for that specific case would be the 404 page with a 404 HTTP response code.
Which is exactly what happens if I type:
http://hostname.com/loc4tion
(no template exists with the alias loc4tion)
What am I missing? Am I trying to do something wrong?
I tried to set to true the "disableAlternativeTemplates" in the umbracoSettings.config which works, ignoring the alternatives allowed templates for that node, rendering it with its default template, but still 200 response with a non-existing URL.
It's like if I add the alias of an existing template and the end of any URL, there will always be a page responding 200, no matter what is set for that page.
I already have a custom IContentFinder, but that is not fired when a template alias is found.
Alternative Template http response
I found some posts about this, but I'm not sure my scenario is the same.
My main issue is that nodes in my Umbraco render with the alternative templates url syntax (i.e. http://hostname.com/TemplateAlias) for templates are NOT allowed for the node.
A practical example: the Home node has got only one Allowed template with alias "home". Another template exists with the alias "location". If I type something like http://hostname.com/location the home page is rendered and the HTTP response code is 200. So from a SEO point of view the page http://hostname.com/location exists and it's a duplication of the home page (which to me it's a double mistake). What I would expect for that specific case would be the 404 page with a 404 HTTP response code. Which is exactly what happens if I type: http://hostname.com/loc4tion (no template exists with the alias loc4tion)
What am I missing? Am I trying to do something wrong?
I tried to set to true the "disableAlternativeTemplates" in the umbracoSettings.config which works, ignoring the alternatives allowed templates for that node, rendering it with its default template, but still 200 response with a non-existing URL.
It's like if I add the alias of an existing template and the end of any URL, there will always be a page responding 200, no matter what is set for that page.
I already have a custom IContentFinder, but that is not fired when a template alias is found.
Any thoughts?
Umbraco version 7.7.8 assembly: 1.0.6582.14881
Maybe also check out the
404handlers.config
file (in/config/
). By default it looks like:Try removing the
SearchForTemplate
handler from the list. Can't guarantee it will work, but worth a shot.Many thanks Dan, it seems to work as expected.
Now this URL http://hostname.com/location returns a 404 which is correct as there's no location node, location is only a template.
Is there any other consequence in switching the SearchForTemplate off? Anything I should take care of myself...
No, there shouldn't be any consequences that I'm aware of (apart from the obvious fact you won't be able to use alternative templates any more :p).
is working on a reply...