Support

Admin Tools

#37017 Redirect www and non-www addresses 'greyed out' in htaccess maker

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
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Monday, 25 April 2022 13:13 CDT

akcreation

Please look at the bottom of this page (under Support Policy Summary) for our support policy summary, containing important information regarding our working hours and our support policy. Thank you!

Hi there, I noticed that my site has started allowing 'non-www' in the domain, which it wasn't allowing before. I use the admin tools 'htaccess maker' for this.

I have just updated the admin tools plugin, and also changed my php version to 8.1 and I can see that if I go into my htaccess maker the 'Redirect www and non-www addresses' is now greyed out and I cannot change it.

Please can you advise why this is happening and how to fix it.

The site is built on Joomla 3 and is running on 3.10.8 (the most up to date version of Joomla 3)

Many thanks,

Keith

nicholas
Akeeba Staff
Manager

You have set the $live_site in your site's configuration.php file. The non-www to www redirection (or vice versa) is not allowed as it would create a redirection loop.

For example, let's say that your $live_site is https://www.example.com and you set a www to non-www redirection. When you access your site as https://example.com the .htaccess file will redirect you to https://www.example.com. However, this does not match the $live_site. As a result Joomla itself will redirect you to https://example.com. This will cause the .htaccess code to redirect you back to https://www.example.com and so on and so forth until the browser gives up, effectively making your site inaccessible.

The same thing happens if your $live_site is using http:// but you are using the HSTS option in the .htaccess Maker.

There are two alternative solutions:

  1. Do not use the www to non-www (or vice versa) redirection and the HSTS features in the .htaccess Maker.
  2. Empty the $live_site in your configuration.php file, you do not need it in most cases (if you don't know if you need it then you definitely don't need it, this feature is there for some broken configurations which were rare back in the late 00s and practically non-existent in modern server environments).

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!

akcreation

Hi Nicholas,

Thank you so much for your excellent support (as always).

I removed the setting in the global config file and now everything is working as before.

The strange thing is, I have never set that 'live_site' variable, so I have no idea what changed that, maybe an extension I have installed has done this?

But whatever the reason, it is now fixed - thanks again :)

nicholas
Akeeba Staff
Manager

I can tell you that $live_site is not exposed in Joomla's Global Configuration, so you didn't do it through that interface.

I can also tell you that if you recently restored a backup of the site the Site Setup page does have a Live Site field which lets you change the $live_site in the configuration.php. We have that option there in case you had already set it in the backed up site and you're restoring the site to a different domain β€” but we won't stop you from abusing it either, following the old UNIX mantra that you don't ask a user why they want to shoot their feet, you just give them the biggest, meanest gun which will shoot their feet clean off the first time they try.

If that wasn't the case, yes, it must have been an extension doing that. Doing that without your explicit consent would be a big red flag β€” nothing should ever change the configuration.php file unless the user is absolutely clear on what is going to happen and explicitly provide their informed consent. Any problems emanating from a configuration.php change can be, as you found out, very hard to troubleshoot unless someone who's seen that problem before tells you where to look and what to look for.

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!

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!