Support

Admin Tools

#29030 Allow direct access (url) to files/folders only for logged in user?

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 on Friday, 23 February 2018 17:17 CST

jjst135
Hi!

I have a more general question. Is it possible to allow direct (url) access to files only for registered users?

Say we have an intranet site only for registered users. And they can upload their profile image. Would it be possible to block access to this image for public visitors? When images are load to the image folder of Joomla they are always reachable through the direct URL right?

I know there are 3-party component that use a folder with a htaccess protection (deny all) and the only give access through a PHP loading script. But I was wondering if it is somehow possible to protect for example:

images/foto/myfoto.jpg

When someone uses this URL and is not registered I would like them to be redirected to the login page. But logged in users (and the joomla template) can access the file directly.

Any tips and thought on this? Is this possible?

Thanks!

nicholas
Akeeba Staff
Manager
This is not possible to do with a .htaccess file. Joomla! login and ACLs are handled by Joomla! itself. The validity of the login cookie has to be verified by PHP code which runs during the Joomla! startup process. The .htaccess is evaluated long before that point in time. That's why protected content is placed in web-inaccessible folders and access to it is provided through PHP code, e.g. what we do with the Pro versions of our software, the attachments on the ticket system etc.

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!

jjst135
Ok, thanks for the info!

nicholas
Akeeba Staff
Manager
You're welcome!

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!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

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!