Support

Admin Tools

#38140 Rewrite Rule Issue

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.2.5
PHP version
7.4
Admin Tools version
7.1.11

Latest post by nicholas on Tuesday, 06 December 2022 01:46 CST

dhillock

I recently upgraded my J 3.10.11 website to J 4.2.5. Having upgraded, I reinstalled Admin Tools

Using the htaccess maker, I clicked the "Reset Htaccess Maker options" and then clicked the "Save and create .htaccess".

In doing so, I got a 500 Internal Server Error, with these messages, pn both the backend and the frontend:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

 

It seems that one of the rewrite rules has an unwanted carriage return.

This is the original rule:

##### No directory listings -- BEGIN
IndexIgnore *
Options -Indexes +SymLinksIfOwnerMatch
##### No directory listings -- END

This is my edit of the original rule

##### No directory listings -- BEGIN
IndexIgnore *Options -Indexes +SymLinksIfOwnerMatch
##### No directory listings -- END

Once I made the change, everything worked fine.

Is there something that I can do to ensure that this rule is properly written, to avoid the error in the future.

Thank you and take care.

David

nicholas
Akeeba Staff
Manager

When you do not in fact have any idea what you are doing please do NOT make assertions about you "fixing" anything on a public ticket. Other people are reading this and will follow your bad advice, exposing their sites to danger. You did not fix anything, really, you broke one thing and removed another. What you removed made a difference — but you could have done that far more safely, without breaking ANYTHING else, using the .htaccess Maker options.

Let's take this step by step

Thing broken #1

What you actually did was screw up the IndexIgnore rule and remove the Options rule. 

The original rule

IndexIgnore *

literally means that all files and folders should be excluded from the automatically generated directory index, in case we cannot set the -Indexes flag in Options (this rule would cause Apache to produce an empty listing in this case). Apache Documentation: https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html#indexignore

What you did was change that line to say that Apache should not put the following files into the automatic index:

  • Files whose name ends with the literal string Options
  • Files named -Indexes
  • Files named +SymLInksIfOwnerMatch

By messing up the rule you have now re-enabled Apache's behaviour of producing a directory listing of your directories.

Thing removed #2

You completely removed the Options line. Apache Documentation: https://httpd.apache.org/docs/2.4/mod/core.html#options This line was trying to completely disable automatic directory indices and tell Apache to only follow symlinks if it's safe to do so (the symlink target's owner matches the user the Apache request runs under, i.e. you can no longer use a symlink to read a system file you are otherwise disallowed to).

The latter feature is not supported on all servers. That's why the .htaccess maker option to control it comes with a clear warning “(may cause a blank page or 500 Internal Server Error)” in its name ;)

Correct steps to fix your issue

Everything in the .htaccess file is controlled by options in the .htaccess Maker settings. The settings you are looking for are:

  • Disable directory listings (recommended): set this to Yes; it should already be set to Yes
  • Follow symlinks (may cause a blank page or 500 Internal Server Error): set this to “Server Default

Click on Save & Create .htaccess. Done.

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!