As explained in the previous article, you should avoid 404 errors (page not found) as much as possible. Of course, we can not prevent all of those, say if a user mistypes a URL, but in a lot of other cases they can be avoided easily. Especially if you are migrating from an old site to a new one, your URL's will change. When users do not update their bookmarks they end up on the old non-existing URL. Also, the Google index will take a while to update, and it will keep on sending users from the search results to your old URL's. This can heavily impact your search rankings!
The way to go is to determine what your old URL's are, and to reroute them to the new ones. Technically, this should be done through a so-called 301-redirect. Such a redirect is accompanied by a permanent-moved-code. This lets Google and other search engines know that the old link should not be used anymore, and also informs them of the new URL. If you are lazy, you could choose to let all links automatically end up on the homepage. Then you have at least informed Google that they have been redirected, but you may lose all rankings built up for the specific pages. better is to reroute the links on a page by page basis.
The best way to go would be to determine and fix these URLs before actually upgrading or changing your site, but as long as you quickly fix them after the URLs changed, you should be fine.
Redirect Manager Component in Joomla
For a small site, this can easily be fixed. Make sure you still know what your old URL's were, and then just enter this URL. Or you just wait one or two days until users will have hit these pages. These pages will now be registered in your Joomla site: Go to Components -> Redirect and you will see them in the Redirect Manager: (sometimes you need to enable the Redirect plugin from the Plugin Manager first). You will now see a list of URLs that generated 404-errors:
Click on any of the items listed:
Opening any specific item will allow you to enter the new URL (either relative or absolute) and enable the record.
Redirects in bulk
The method as described so far allows you to set redirects on a one-by-one basis (tip from the Joomla Magazine). However, there is is also an option to route multiple records to one destination-URL in bulk. To do so, select the records you want to change, and set a new destination in the field located under the list:
This can save you a lot of time. Note that the records are enabled immediately, no need to set this separately.
Redirect Component: stop logging new URL's
There used to be one little disadvantage to the Redirect Component: As long as the plugin is enabled, it keeps logging all 404-errors Some sites suffer funny 404-errors (often generated by hackers and bots) continuously, which can seriously fill up the logs, so keep an eye on this. This can even fill up your database up to the limits! You can, of course, clean up the incorrect records manually, but that can be quite a task. The only alternative used to be to switch of the plugin, but that also made the existing redirects inactive. However, since Joomla 3.4, there is a new setting in the System - Redirect plugin (access it from the Plugin Manager), created by Victor Vogel. This is the Collect URLs setting:
As long it is on, it keeps collecting URL's, but if it is switched off, it will stop doing so, but the earlier configured redirects remain active. This is really the one feature that the component was lacking, and now it is an extremely useful component that I will actually use!
By the way, another function that is a bit hidden is the Activate advanced mode button in the general options of the Redirect Manager component. It does not immediately tell you what it does, but it gives you the option to specify the HTTP-response code in your individual redirects. The default is a 301-redirect, but now you have the option to change this to anything you want. I do not see the direct need to do so, but at least you have the option to do so now:
An alternative for the Redirect Manager component is to create them manually in .htaccess:
Custom redirects in .htaccess
Also, it might be just as easy to perform your 301-redirects in an .htaccess file. Especially for technically more skilled persons this is an often used method. Also these redirects have a slight performance gain, as they are executed before Joomla is activated. To use them, define your source and destination URLs, and enter the following example code:
RewriteRule ^oldpage1$ "http://newsite.com/newpage1" [R=301,L]
RewriteRule ^oldpage2$ "http://newsite.com/newpage2" [R=301,L]
The good thing is that this is a very exact way of dealing with your redirects. No extension needed, as long as you know what you are doing. Also, performance is least affected, as these redirects are executed by the Apache server software before Joomla is even activated.
Possible SEO disadvantages of 301-redirects
Note that when you redirect a URL, the "value" of the old URL is mostly transferred to the new one, but not 100%. In this study by Moz, it was found that 10-15% of the average rankings were lost when URL's were redirected. Especially when redirecting is not a must, say when you just want a slightly cleaner URL than the existing, (maybe /swimming-pool versus /swimmingpool-constructor), this might be a consideration.
Of course, there are nice extensions for this purpose as well. A nice one is RedJ, which allows for rather complex redirects, using macro's and regular expressions. An alternative that performs automatic redirects for you is Yireo's Dynamic 404, which is capable of 301-redirecting not-found pages to the most corresponding existing one. By the way, since version 4.5, also SH404SEF has the option to automatically forward 404-errors to the most corresponding correct page.