Products » Knowledge Base » Url Master 

Url Master Help Wiki

Why don't nonexistent child pages return 404


Often people come across the situation where they request an invalid page on their site, and find that the Url doesn't return a 404 when they expected.



For example, assume this is a valid page: example.com/valid-page. Then, if someone tries to request this url : example.com/valid-page/invalid-page, and there is no child page of 'invalid page', you might expect a 404 error to be shown. But with the Url Master module, this is not the case. Instead, what you do see is the 'valid page' content shown.



This is not a bug, it is expected behaviour. The reason is in how the module handles Urls for third-party modules that display content based on the Url. If you take the Blog module, for example, then this is what the 'standard' blog page might look like:


example.com/blog


If you view this Url, you'll see a summary of all blog posts.


If you then request a specific blog post, you'll see a Url like this:


example.com/blog/entryid/23/the-blog-post-title


You'll not that the /blog/ part of the path specifies which DNN page to use. The remainder of the path /entryid/22/the-blog-post-title is determined by the Url Master module to be specific to some other module on that page, so is rewritten as part of the Url. The end result, rewritten Url will look like this:


example.com/default.aspx?tabid=xx&entryid=32&the-blog-post-title


This is because the module takes whatever comes after the best-match on page path, and converts it into a querystring


So when you request a Url like this : example.com/valid-page/invalid-page, the /valid-page/ part of the path is matched to a DNN page, and the rest is assumed to be part of the querystring for that page. The rewritten Url will look like this:


example.com/default.aspx?tabid=xx&invalid-page


Because the Url Master module does not know what modules are on a DNN page, and cannot know in advance what type of Querystring values they expect, it passes through anything after the DNN page match as a querystring.


That's why non-existent child pages don't return a 404 - because there's no way of the module knowing if that part of the Url was an invalid page, or whether it was information required by a module on the page.


Whilst this seems like a design fault, in practice it's rarely an issue. If you have deleted a child page, best practice is to set up a redirect for that 'old' Url. If you delete the page and leave it in the recycle bin (a soft delete) then the Url Master module can detect the delete and return a 301 or 404 status (depending on settings). If you 'hard' delete the page then simply setup a redirect to catch the old value and redirect it someplace. And if you have an external link to your site going to a non-existent page, then just capture that Url with a redirect.


This particular design quirk is being looked at for future releases, but any solution is going to be very harsh in it's implementation, and use of it will require 'opening up' those settings when you wish to use a third-party module on that page.




 |  View Topic History  |