Because I want to return a 404, not a 301 or 302. A redirect is precisely what I'm trying to avoid (and what Google is complaining about in the form of 'soft 404s').
It could be done in onRequestStart, but it applies to about a dozen event handlers. I hadn't considered the eventtypes - I will give that a whirl - thanks! Brian On Sunday, February 23, 2014 3:43:06 PM UTC-8, todd sharp wrote: > > What's wrong with cflocation? That's the point of a status code - moved > temporarily or permanently (301 or 302). > On Feb 23, 2014 5:10 PM, "Brian G" <[email protected] <javascript:>> > wrote: > >> >> I have an event listings website and from time to time, events are >> deleted or links to them are broken which generate soft 404 errors in >> Google webmaster tools. Basically, the page isn't found and I currently >> result to redirect them back to an event search page. I'd like to clean >> this up and properly handle it for Google by NOT redirecting but returning >> a 404 with a helpful event search page. I can see how to create a default >> exception handler but that causes a cflocation. I thought I could maybe >> use event.forward() but that too uses cflocation. >> >> Is there a way in MG from a controller, when I don't find something in >> the database, to immediately execute a 404 handler WITHOUT a redirect? >> E.g., the URL should stay the same with the "/this/url/doesnt/exist" and I >> could return a 404 header. I don't want this site-wide, it should only >> handle my event listings. >> >> The only thing I can think of right now is to create a proxy >> eventhandler... like >> >> <event-handler name="display-event"> >> <broadcast> >> <message name="doCheckEventExists" /> >> </broadcast> >> <results> >> <result name="isFound" do="display-event-found" /> >> <result name="notFound" do="display-event-404" /> >> </results> >> </event-handler> >> >> This will work, but I would have to apply this proxy in quite a number of >> places in my eventhandlers XML. I'd rather consolidate it down to the one >> place in my event controller where I determine whether the event id passed >> in the URL can be found, regardless of the kind of output (event info, >> event requirements, attendee list, results, etc). >> >> >> Brian >> >> >> -- >> -- >> Model-Glue Sites: >> Home Page: http://www.model-glue.com >> Documentation: http://docs.model-glue.com >> Bug Tracker: http://bugs.model-glue.com >> Blog: http://www.model-glue.com/blog >> >> You received this message because you are subscribed to the Google >> Groups "model-glue" group. >> To post to this group, send email to [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/model-glue?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "model-glue" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en --- You received this message because you are subscribed to the Google Groups "model-glue" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
