Support

Admin Tools

#39446 How does redirect plugin work with 301 redirect?

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
4
PHP version
8
Admin Tools version
9.6.2

Latest post by iamrobert1978 on Friday, 08 September 2023 09:42 CDT

iamrobert1978

Hi,

I've started using the redirect plugin - and it is working well.

However, I'm a little confused about how it works as I don't see any of the redirects listed in the .htaccess file. 

My client is curious about 301 redirects, especially with SEO in the picture.


A couple of questions:

 

  1. How exactly are these redirects being handled?
  2. Are these redirects 301 by default?

I've reviewed the documentation but only this plugin's SEO implications.

Thanks

nicholas
Akeeba Staff
Manager

Using the .htaccess file for redirects is not a great idea when it comes to performance. Do remember that your web server needs to locate, load, and parse the .htaccess file(s) on every request. This means not just the request to load the page, but also all HTTP(S) requests to load the individual CSS, JavaSript, image, video etc files. A .htaccess file with a hundred or so redirects would add between a dozen and a hundred milliseconds of page load time on average.

Instead, we make use of an implementation detail of Joomla!.

The default .htaccess content of Joomla (shipped as htaccess.txt) has the following stanza towards the end:

RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

This tells the web server to load Joomla's index.php whenever it is asked to access something which is neither a file nor a directory on the server's filesystem.

When Joomla's index.php file is accessed, Joomla “boots up” its application, which is to say that it loads its absolutely necessary core files, system plugins, tries to figure out if it can handle the URL requested, and then asks the plugins to handle the onAfterIntialise plugin event. The System – Admin Tools plugin handles this event, and that's where we do our redirection magic.

We check the requested URL against the list of redirections stored in the database. If something matches, we ask Joomla to issue an HTTP 301 redirect to the configured target (“Redirect to”) URL. Joomla dutifully does so, and stops processing anything further.

For the purposes of SEO these are identical to redirections taking place at the web server level with .htaccess code. However, since the redirection code only runs once per page load, instead of on every request, it has a much smaller effect on the performance of your site. Since your site loads faster, it only does good things to the site's search engine score.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

tampe125
Akeeba Staff

Hello,

those redirects are handled by the system plugin that lives inside Joomla environment. When the requested URL matches, we will send out an HTTP header that will tell the browser to redirect to another page.

We issue a 301 redirect which means that the previous page has been permanently moved to the new location, in this way search engines will stop indexing the old URL and only consider the new one.

Davide Tampellini

Developer and Support Staff

🇮🇹Italian: native 🇬🇧English: good • 🕐 My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

iamrobert1978

Thank Nicholas and Davide, for your detailed responses.

I've learned something new about Joomla and the htaccess file as well.

I'll use it for redirects instead of adding redirects to the top of the htaccess file where possible.

 

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!