When you run any website, there are inevitably changes to be made to it. While you might get a point where your work on it pauses, the time comes back again when you need to perform updates. Oftentimes, these updates will include new pages and/or new page structure.
If you’re just adding a new page to a site, no problem. But what if you’re moving your pages around? For example, what if you begin with a simple top-level menu like in the image below?
At some point, you will likely need to add more pages as your site grows. Perhaps you need to add more pages like Support, Social Media, and News. As you do, you will almost certainly need to move pages around to accommodate the additional top-level pages that you need to add. Otherwise, you menu might look something like this…
Notice in the above screen shot that the pages begin to wrap to the next line, because the skin can only support so many pages in the menu. This would be true of nearly any design. The logical “fix” to this problem would be to consolidate related pages into a sub-menu.
Before we do that, I want you to note something. Right now, all of these pages have a specific URL. For example, the News page URL would look something like this:
This is true of all of the top-level pages. The Products pages would be named Products.aspx. This is the default behavior in the DNN 5 series, where the Human Friendly URLs are enabled.
Now, let’s consolidate the menu items. In this example, it would appear that with our running example menu, that the News, Contact Us, and Location pages can easily be grouped as sub-menu items under the About Us page. When we do this, the pages will look more organized, and the end result will look something like this…
This looks much better! The menu doesn’t wrap anymore, and the pages are intuitively placed, keeping the most important information available as top-level menu items. I am sure someone will be happy, right?
Uh oh… You just got some praise for organizing the pages, but an unfortunate side effect just happened. Remember the URLs? I am sure you do. When we moved the pages, we also changed the URLs that the pages are assigned to. For example, the New page now responds to the following URL:
So what happens now when someone visits the original URL? Unfortunately, unless you are handling broken links gracefully – which you can do – your visitor will be met with an HTTP 404 Page Not Found Error, like shown in the screen shot below.
This is not a desired result. This is especially true of websites that are forward-facing, where search engines may be pointing potential visitors (customers) to the page. A better option would be to tell the search engine where the page has moved to.
There is a way to prevent this. When you decide to change your page organization in such a way, you shouldn’t simply move your pages. Instead, create new pages where you want to move the existing pages. Use all of the same meta data and settings that you were using in the original pages. Next, “move” all of the modules from the original page, to the new page. You can do this by viewing the Module Settings page for each module, using the Actions Menu. Once there, expand the Page Settings section, and then expand the Advanced Settings section. Finally, choose the page you just created in the dropdownlist for the Move to Page setting. Click Update to save your changes.
In know… That setting is pretty buried. It’s a feature that’s rarely used in most installations though – so it’s okay. ;)
Once you have all of your modules moved to the new page, we will need to point the old page to the new one, and remove it from the menu. Why? Well, we need to remove it from the menu because we don’t need it there any longer. This will give the appearance that we did indeed physically move the page. Then, we need for the old page to point to the new one for anyone that might be linking to it, including search engines.
Go to the Page Settings for the old page, and then uncheck the Include in Menu checkbox to remove it from the menu. Then, expand the Advanced Settings section, and find the Other Settings section at the bottom of the page. You will have an option to choose “a page on your site” to link this page to. Use the radio button and resulting dropdownlist to choose the new page as a link.
It would seem that we’re done now, but we aren’t. Check the checkbox labeled Permanently Redirect. Doing so will tell the web browsers and search engines that the page has “permanently moved” by issuing an HTTP 301 Permanent Redirect header. If you don’t check the checkbox, then an HTTP 302 Page Temporarily Moved header will be issued instead. In the latter, search engines will not update their search index.
Click Update to save your changes.
I haven’t addressed broken links yet. This is because I really wanted to tell you how to prevent the broken links by teaching you a “best practice” method of page management. However, if you find that you are receiving requests for pages that no longer exist, I would suggest that you recreate the page, and have it Permanently Redirect to the homepage, or another relevant page on your website.
Sometimes, you need to look to 3rd party solutions to make things easier though. A 3rd party option for this situation would be a module such as the URL Master module by iFinity. Modules like this one do much of this work for you, or make it easier.
In fact, modules such as the URL Search module allow you to even look for broken links in your own website. This is especially useful for sites that have multiple content editors, where you might not be able to know when people are publishing broken URL’s, or need to replace ones that were added previously.
Finally, something I do on my own site is simply replace all of the broken URLs as I find out about them. This can be done through one or more SQL scripts, or you can once again use a 3rd party module. I use the PageBlaster module from Snapsis. Using this module, you can specify any text string to replace before page load. If you don’t know what you’re looking for though, Engage Software offers a free module they call Engage:F3 to find these broken links.