Hi there, I need some good advice on how to solve the following problem.
I build a Website with lotts of pages inside a hirachical tree.
Without myself being a SEO, I did like someone suggested to me and disabled the nested urls. So every page inside the tree is accessed directly by its urlsegment, without being a followup behind its parents urlsegments and shlashes inside the url.
I also used the googlesitemaps module and google allready indexed my ~80k pages.
Now an expert suggested to me, that nested urls are far better for google to index, because it can follow a hirarchie.
My Idea now is to simply switch on nested URLs, but in the same time redirect all incoming requests for the pages original urlsegement to the new nested urlsegment.
Therefor a hook, to check if an unresolved route matches the URLSegment of a Page within the SiteTree would be ideal.
If a matching Page Object can be found, redirect to this page objects new nested url, otherwise respond with a 404 should do the trick.
But my question now is, how can I inject this logic into the router right after a matching route can not be found but before the 404 is send?
kind regards
andre