We have an insallation of Umbraco 7.3.3 which is used for 5 of our smaller websites, each with their own templates & content, setup using different hostnames in Umbraco.
We want to have different 404 error pages for each site.
I know about setting the error404 setting in config\umbracoSettings.config as below
@Craig: This is wht the docs say, and is okay with multiple cultures setup, but we have mulitiple sites with the same culture in one instance of Umbraco.
@David: This looked like an easy solution, but I couldn't get it to work. It would always return the error page for the first site/root node.
There is another post with someone else having the same issue with the Page Not Found Manager plugin.
@Chriztian: Thanks, I managed to get this working.
First looked at it and it looked a bit over my head! But I got it working, and was pleased, but then noticed that although it was showing the correct 404 page for each site, the http status was 200.
I fiddled about a bit and found that putting
contentRequest.SetResponseStatus(404, "404 Page Not Found");
Error pages by hostname
Hi,
We have an insallation of Umbraco 7.3.3 which is used for 5 of our smaller websites, each with their own templates & content, setup using different hostnames in Umbraco.
We want to have different 404 error pages for each site.
I know about setting the error404 setting in config\umbracoSettings.config as below
https://our.umbraco.org/Documentation/Reference/Config/umbracoSettings/#errors
It shows you can have different error pages per culture, but all out sites are en-GB
Is it possible to set diffenrent error404 pages per hostname?
Thanks, Mike
Hi Mike,
You could try the following:
Edit your 'umbracoSettings.config' file.
Set the culture for each errorPage section defined and also the NodeId of the 404 page for each site.
You will also have to edit your web.config and allow your Umbraco error pages to pass through IIS.
Let me know how it goes!
Regards
Craig
Hi Mike,
maybe this can help you: https://our.umbraco.org/projects/backoffice-extensions/umbraco-page-not-found-manager/
Regards David
Hi Mike,
If you want to dig a little deeper, Anders Bjerner wrote a good post about three different types of error pages over on the 24 Days In Umbraco site...
Hope that helps,
/Chriztian
Thanks for your replies.
@Craig: This is wht the docs say, and is okay with multiple cultures setup, but we have mulitiple sites with the same culture in one instance of Umbraco.
@David: This looked like an easy solution, but I couldn't get it to work. It would always return the error page for the first site/root node. There is another post with someone else having the same issue with the Page Not Found Manager plugin.
@Chriztian: Thanks, I managed to get this working.
First looked at it and it looked a bit over my head! But I got it working, and was pleased, but then noticed that although it was showing the correct 404 page for each site, the http status was 200.
I fiddled about a bit and found that putting
before the final return fixed that.
So all is looking good now.
Cheers, Mike
Just found this is causing a problem with pages with an alternate URL with umbracoUrlAlias
When you browse to the umbracoUrlAlias URL they all return 404 errors, if I disable the code then the umbracoUrlAlias work again.
Browsing using the full URL works, just when using the alternate url.
is working on a reply...