Skip to main content

301-redirects (Joomla core vs .htaccess)

Setting up correct redirects is often the core business of any SEO consultant. It is the solution for many failed site setups and smaller issues. Some issues that lead us to have to setup redirects are:

  • Site redesigns with a changed URL structure
  • Redesign in a suffix, like moving from URLs ending with .html to clean URLs
  • Dead links that keep causing 404 errors
  • Changing the alias of a single article or menu-item
  • Duplicate content URLs that we want to get rid off
  • Etcetera

As explained in the next article, you should avoid 404 errors (page not found) as much as possible. Of course, we can not prevent all of those. If a user mistypes a URL that can hardly be foreseen (unless you are aware of known typos people make). 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 URLs will change. When users do not update their bookmarks they end up on the old, non-existing URLs. Also, the Google index will take a while to update, and it will keep on sending users from the search results to your old URLs. This can heavily impact your search rankings! The same counts for smaller changes. If you change an alias for an article or a menu item, the URL will also change.

The way to go is to determine what your old URLs are and to re-route 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 (301). This lets Google and other search engines know that the old link should not be used anymore, and it also informs them of the new URL.  You should make sure that the new URL matches the old one as closely as possible. In the example of a site redesign, where all URLs are changed, you can set up redirects in 2 ways:

  • 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 the old URL has 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. This is a lot more work but will give much better results.

Then you also have to consider when to apply redirects. In the case of planned situations (like a redesign), both the old and the new URL structure are known. Then 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 change, you should be fine: in this case, you simply monitor your 404 pages and fix them one by one.

Redirect Manager Component in Joomla

Joomla ships with a mechanism to monitor 404 errors that also allows you to set a redirection target. Note that it only works for actual 404 errors, you cannot redirect a valid URL, as it does not generate a 404 first.

To use the Redirect Manager, go to System -> Manage -> Redirects and you will see them in the Redirect Manager: The first time you use it you will be notified that you first have to enable the Redirects plugin from the Plugin Manager. Of course first of all it should be enabled, but you also have the option to switch on the Collect URLs option.

The reason it is switched off by default is that the database could be flooded with redirect URLs if you don't monitor them. Every site has them, also correctly set up sites. This is mostly because of bots and hackers crawling your site for exploits. That is why I advise you to either monitor regularly (on a monthly basis) or to only monitor URLs at times when you know you can expect 404 issues (say, after a site redesign) and to turn the collection off after that. I usually choose the latter option.

In the Redirect Manager, you will now see a list of URLs that generated 404-errors:


Strange ones like the ones above can be ignored, they are probably from crawlers or bots. But there may also be real errors. If you see one, click on it:

redirect component in Joomla

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. However, there 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:

redirect in bulk

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 URLs

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 off 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). This is the Collect URLs setting:

collect urls redirect manager

As long it is on, it keeps collecting URLs, 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

Often, it might be just as easy to perform your 301 redirects in a .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$ "" [R=301,L]
RewriteRule ^oldpage2$ "" [R=301,L]

The good thing is that this is a very exact way of dealing with your redirects. No extension is 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.

You can also bulk redirect URLs using patterns. As an example, the following code can be useful when you change the setting for adding a .html suffix (in Global Configuration) from Yes to No.  Then the following block of code will redirect all URLs with a .html-suffix to the corresponding URL without:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

(Note that the first line is usually there by default, so place the other 3 lines after this one).

Check out this URL for a whole bunch of advanced examples: 

Finally: don't forget your images! They need redirecting just as "normal" pages. See this blog post here:

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 URLs were redirected. Especially when redirecting is not a must, say when you just want a slightly cleaner URL than the existing one, (maybe /swimming-pool versus /swimmingpool-constructor), this might be a consideration. When I redesign a site, I always try to use the exact same URLs as the old site, as long as this is possible.

Redirect extensions

Of course, there are extensions for this purpose as well. There were some nice ones for Joomla 3, but it seems quite a few of those have been abandoned and are not supported anymore. Personally, I mainly use the Redirects tool from the 4SEO extension for those situations where the core component does not provide a solution.

Ad - SiteGround Web Hosting - Crafted for easy site management. Amazing Speed; Powerful Tools; Top-rated support. Learn more.