I'm after some advice. I'm in the process of rewriting our existing v6 website for v8 which will be a new site, but the original will still be available for now. The content is being re-entered manually as its also a good opportunity to clean out old content.
Each new page has a legacy id property so the editor can key in the page id from the old site as they move it over. I've created a custom lookup table keyed on old id that stores the page url from the old site.
What I'd like to do is intercept the 404 page from visitors who have bookmarked the old url, check whether it exists in my lookup table and if so redirect to the new page that contains the legacy id property.
How can I intercept the 404 to do the above check? For performance reasons I don't want to intercept every request unless I have to, I'd just like some code to run when umbraco is returning the 404.
I would recommend creating a content finder. You can then inject this into the content finder collection before the last chance content finder.
This would then let Umbraco try and find the page and return it if found, else it hits your code to try and find it, and if that then fails it will feed back into the default 404 pipeline :-)
Intercepting the 404 to perform redirect logic
I'm after some advice. I'm in the process of rewriting our existing v6 website for v8 which will be a new site, but the original will still be available for now. The content is being re-entered manually as its also a good opportunity to clean out old content.
Each new page has a legacy id property so the editor can key in the page id from the old site as they move it over. I've created a custom lookup table keyed on old id that stores the page url from the old site.
What I'd like to do is intercept the 404 page from visitors who have bookmarked the old url, check whether it exists in my lookup table and if so redirect to the new page that contains the legacy id property.
How can I intercept the 404 to do the above check? For performance reasons I don't want to intercept every request unless I have to, I'd just like some code to run when umbraco is returning the 404.
Hi Gavin,
I would recommend creating a content finder. You can then inject this into the content finder collection before the last chance content finder.
This would then let Umbraco try and find the page and return it if found, else it hits your code to try and find it, and if that then fails it will feed back into the default 404 pipeline :-)
https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/IContentFinder
Nik
is working on a reply...