Support

Admin Tools

#43456 Redirection URLs do not work for deleted PDFs (in the image folder)

Posted in ‘Admin Tools for Joomla!’
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
6.2.0
PHP version
8.4.27
Admin Tools version
7.9.3

Latest post by moira on Wednesday, 28 October 2026 02:10 CDT

AlainR

Hi,

On a Joomla! site protected by Admin Tools, I am deleting PDFs that I replace with a download component.

I thought I could then create redirects from old links (e.g., images/documents/contrat_placement.pdf) to the new URLs created by the component.

However, I always get an error 404 "Object not found!" and no "false" URL is recorded in the Joomla! redirects.

I then tested the redirects proposed by Admin Tools but without any further success. I also tried, via the creation/edition tool of the . htaccess to "unblock" access to the images/documents subfolder, but without further success (probably because I configured it incorrectly).

I also tried to deactivate the Admin Tools system plugin.
The only way that works is to hand over the Joomla. htaccess file.

Do you have any advice for me?

moira

The cause is a default rule in the .htaccess Maker’s Server Protection, and you can work around it right now with a few lines of custom code. This is not a mistake in how you configured the .htaccess Maker.

Why this happens

By default, Server Protection allows direct access to static files of certain types (including PDF) inside certain directories (including images). It does so by telling Apache “serve this file directly and stop processing any further rules”. That is fine for files that exist. When the file has been deleted, Apache still stops there, finds nothing to serve, and answers with its own bare 404 “Object not found!” page. The request never reaches Joomla, which is why no URL is recorded in Joomla’s Redirects component and why the Admin Tools redirections have no effect. Joomla’s stock .htaccess file does not have this rule, which is why it works with that file. Disabling the Admin Tools plugin makes no difference, because this rule lives in the .htaccess file, not in the plugin.

Adding images/documents to the “Allow direct access” lists could not have helped, as the default rule above already applies to your PDFs. Please do not remove images or pdf from the front-end lists as a workaround: that would make Server Protection block your existing PDFs with a 403 error.

This is what we believe is going on, based on reading how the .htaccess Maker generates its rules. We have not seen your .htaccess file, so we cannot be absolutely certain. The test in step 4 below will tell you.

How to make Joomla handle deleted files in images/documents

  1. Go to Components, Admin Tools, .htaccess Maker.

  2. In Custom .htaccess rules at the top of the file add the following three lines. If the field already has content, add them on new lines after it:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^images/documents/ index.php [L,NC]
  3. Click on Save and Create .htaccess in the toolbar.

  4. Visit the URL of one of the deleted PDFs in your browser. You should now see your site’s own 404 page (or, if you have already set up a redirect, you will be redirected) instead of the bare “Object not found!” message.

  5. Create your redirects, either in Components, Admin Tools, SEO and Migration, URL Redirections, or in Joomla’s Redirects component.

These rules only apply to URLs under images/documents/ which do not correspond to an existing file or directory. Existing files continue to be served directly, and Server Protection continues to work as before for everything else. If you need the same for another directory, change images/documents/ to that directory’s path, or add one more such set of three lines per directory.

If step 4 still shows the bare “Object not found!” page, please reply with the full contents of your site’s current .htaccess file. Something other than the default rule is then responsible, and we need to see it.

What we are doing about this

We are adding an option to the .htaccess Maker’s Server Protection, “Accessing non-existent files (frontend)”, and a matching one for the backend. The default will remain the current behaviour (the server returns HTTP 404 Not Found). Choosing “Joomla handles them” will make Apache pass requests for missing files to Joomla, which does the same thing as the custom code above, without you having to write it. I cannot give you a release date for it yet. Until then, the custom code above does the job and will keep working after the option arrives.

Moira Fari

Support Specialist

🇬🇧English: native 🕐 My time zone is Asia / Nicosia
Kindly note that my replies are fully vetted by our developers.

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!