I have an umbraco install that contains several different sites. I wanted to turn on the default Umbraco 404 handler, but I need to enter a content ID for that. I don't want to do that, because that would make people go out of the current site that they're in and into a different site (or no site at all).
The second problem I have is that my site has a stretchable layout, it will always be 100% width and height. I have some pieces of content showing up in a lightbox, like the contact and "about us" page. I'd like to show the 404 error in a lightbox like that.
So what I'd need is: when a 404 error is triggered, I want it to show up in the homepage of the site that the user is in, with the lightbox visible (this is already possible by going to the url like so: http://site.com/?popup=/pages/404.aspx).
Can this be done? I think it could be done by doing a url rewrite, but I am unsure of how to do this in a multisite set-up.
Great tip! I just implemented the 404 handler from the wiki and changed the Execute method to the below code, it's not pretty but it does the job.
public bool Execute(string url)
{
var server = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower();
var redirectUrl = string.Format("http://{0}/?popup=http://{0}/?altTemplate=NotFound", server);
HttpContext.Current.Response.Status = "404 Not Found";
HttpContext.Current.Response.Redirect(redirectUrl);
return true;
}
404 to a specific URL (not a node)
I'm looking for some input on this subject:
I have an umbraco install that contains several different sites. I wanted to turn on the default Umbraco 404 handler, but I need to enter a content ID for that. I don't want to do that, because that would make people go out of the current site that they're in and into a different site (or no site at all).
The second problem I have is that my site has a stretchable layout, it will always be 100% width and height. I have some pieces of content showing up in a lightbox, like the contact and "about us" page. I'd like to show the 404 error in a lightbox like that.
So what I'd need is: when a 404 error is triggered, I want it to show up in the homepage of the site that the user is in, with the lightbox visible (this is already possible by going to the url like so: http://site.com/?popup=/pages/404.aspx).
Can this be done? I think it could be done by doing a url rewrite, but I am unsure of how to do this in a multisite set-up.
I think this functionality is allready build in IIS, but I can't find out how to completly disable umbraco 404 handling.
So, you can create your custom 404 handler - http://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handler
Petr
Great tip! I just implemented the 404 handler from the wiki and changed the Execute method to the below code, it's not pretty but it does the job.
is working on a reply...