How to create a directory with miscellaneous non-Joomla files in a Joomla installation? Topic is solved

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Mon Dec 02, 2019 8:34 pm

In a Joomla ver. 3.9.13 that is placed at the website root under "public_html/" in file system, I would like to make some files available through a separate directory, for example "public_html/my_dir/", for exchange of non-Joomla related files.

It would be great if I can make sub-directories, for example "public_html/my_dir/alfa/" where the user can see the files in that directory, and if I can have access control for each sub-directory, so users will have to type in user and password before being able to see and download the files.

I have tried adding a .htaccess file in the "public_html/my_dir/alfa/" directory with:

Code: Select all

Options +Indexes
but this only removes the "403 Forbidden" error when accessing www.mysite.com/my_dir/alfa/, but does not show the files in the directory. So it appears that some additional setup is required in order to show the files when the directory is placed in a Joomla installation.

Is it possible, and what should I do to make a directory with sub-directories and user control like that in a Joomla installation?

Alternatively, is there some Joomla extension that can provide that functionality?

 
User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26424
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by Per Yngve Berg » Mon Dec 02, 2019 8:42 pm

It will not work because the web server does not have any access control. Everything is access by the user that the web server is running under.

Use the Joomla extension Phoca Download. https://extensions.joomla.org/extension/phoca-download/

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Mon Dec 02, 2019 8:57 pm

Per Yngve Berg wrote:
Mon Dec 02, 2019 8:42 pm
It will not work because the web server does not have any access control. Everything is access by the user that the web server is running under.

Use the Joomla extension Phoca Download. https://extensions.joomla.org/extension/phoca-download/
Thanks for the quick answer.

Though, it is my understanding that the Apache web server can have separate htaccess that can be referenced from htaccess files in each directory.

Wont that be possible ?

User avatar
AMurray
Joomla! Champion
Joomla! Champion
Posts: 5347
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by AMurray » Mon Dec 02, 2019 9:33 pm

Yes, you can protect directories with htaccess/htpasswd.

Your sub directory non-joomla related folder would be like /public-html/my-files.

/my-files is the one you can protect with htaccess.

There are extensions that help you set-up such protected folders e.g. Akeeba Admin Tools is one that comes to mind.

Otherwise, just set it up manually. (refer https://www.htaccesstools.com/articles/ ... rotection/).

This authentication is outside the control of Joomla itself; You can put as many password/usernames as you like in the htpasswd file, just list them one per line as the above link instructs
Regards,
--------------------------------------------------------------
A Murray
Millennium Falcon - it's the ship that made the Kessel run in less than 12 parsecs! The fastest hunk of junk in the galaxy.

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Mon Dec 16, 2019 3:40 pm

@AMurray: Thanks for the answer, and I finally got around to try it out.

It appears that there is something in the Joomla setup that blocks viewing of directory contents with "Options Indexes FollowSymLinks MultiViews" when the directory is under a Joomla installation.

I tried to make a directory at a homepage that does not run Joomla, and after creating the .htaccess file and the .htpasswd files as you suggested I could login in and see the files in the directory when using "Options Indexes FollowSymLinks MultiViews" in the .htaccess file. So far so good :-)

But when make similar files at a homepage with a Joomla installation, I first get the login prompt, but then after typing the right password I get a page that only shows the location as title, but does not show the contents of the directory.

I think that maybe the Joomla .htaccess file blocks for showing the contents of the directory.

Question: How can I enable showing the contents in a directory when in a Joomla installation ?

User avatar
AMurray
Joomla! Champion
Joomla! Champion
Posts: 5347
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by AMurray » Tue Dec 17, 2019 9:21 am

Showing the contents of a directory, that should be doable (but not in Joomla....) in your hosting administration area (cPanel for example), there should be an option to turn off or on the directory listing. It really depends on your host, and what they let you do through cPanel. I think it's called Index Manager. but you can also research the net and find the directives to place in the .htaccess file. https://lmgtfy.com/?q=enable+apache+index+listing

Normally if you have the directory listing off you might see a 403 "Forbidden" error, or a blank page (which would be caused by having a blank index.html page in the folder. since you want to list files in this folder, visible to users coming through the htaccess, then you need to turn on the directory listing, and not have any sort of index file in the folder.
Regards,
--------------------------------------------------------------
A Murray
Millennium Falcon - it's the ship that made the Kessel run in less than 12 parsecs! The fastest hunk of junk in the galaxy.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26424
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by Per Yngve Berg » Tue Dec 17, 2019 7:32 pm

https://extensions.joomla.org/extension/phoca-download/

With Phoca Download you will have access control to the files, something the web sever cannot give you.

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Wed Dec 18, 2019 9:29 pm

@Per Yngve Berg: Thanks for the tip about Phoca Download. Maybe it is better to use an extension instead of trying to create an non-Joomla directory under the Joomla installation.

I will try it out.

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Mon Dec 23, 2019 10:10 pm

Thanks for all the suggestions.

However, I figured out that the reason I could not list directory contents was that Joomla default uses:

## No directory listings
IndexIgnore *

In the directories used for release files I can use:

IndexIgnoreReset ON
IndexIgnore ..

Then listing is possible.

Best regards

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26424
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by Per Yngve Berg » Tue Dec 24, 2019 9:25 am

This is a security risk. It's turned off because a hacker shall not be able to list Joomla files. You can put a separate .htaccess is in the folder that you want to list.

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Tue Dec 24, 2019 9:40 am

@PerYngveBerg:

The intention is exactly to put a separate .htaccess file in the directory with the release files, and this is then to have:

Code: Select all

IndexIgnoreReset ON
IndexIgnore ..
Then listing is possible in the release directories, and the "IndexIgnore .." prevents presentation of a line for "Parent directory", since that is not relevant.

The original Joomla .htaccess file is unchanged, in order to protect against listing of files, as you say.

waarnemer
Joomla! Hero
Joomla! Hero
Posts: 2688
Joined: Sun May 04, 2008 12:37 pm

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by waarnemer » Tue Dec 24, 2019 10:08 am

If you need a file sharing system where users can see and download their content (and even reshare and much much more...) check out Nextcloud.

You will need a valid certificate and preferrably run it from your own accessible server...
If you do not have that, phoca download is your Joomla! option.
The .htaccess/.htpasswd method will make your run into problems in due time.... at worst... at a time you forgot what was setup exactly... potentially you may run into duplicate folder names, rewrite and redirect issues and more... and you need to maintain actively.. the user that forgot his credentials? Will haunt you in your weekends and holidays.....

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Wed Dec 25, 2019 9:54 am

@waarnemer: Thanks for your reply and suggestion.

Through I don't see why the .htaccess/.htpasswd method will give any problems.

As I understand, the .htaccess/.htpasswd is a fundamental and widely used feature provided directly by the webserver, and the provided directories can be accessible without any modifications to the Joomla installation.

I agree setup and maintenance must be handled correctly, but I think that is the case no matter what solution is chosen.

waarnemer
Joomla! Hero
Joomla! Hero
Posts: 2688
Joined: Sun May 04, 2008 12:37 pm

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by waarnemer » Wed Dec 25, 2019 11:45 am

@MortenZdk

it is fundamental technology yes, widely used for this? no.

for maintenance you need to grant full access to your sites tree to the maintainers. when using J! ACL you can align your roles...

and by using phoca, you don't need to change or modify any Joomla! too.. You then have a powerful extension that can handle Joomla! ACL on downloadable content.
Using Joomla! ACL it becomes easier to even allow or disallow your downloadable content to groups..

htaccess/htpasswd is nice when you only have a few (5) employees within the same organisation... soon as you have more users, coming from anywhere and at any time.... you will have a tough job handling all requests on forgotten passwords and all other kind of bug fixing...

MortenZdk
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 26, 2016 8:48 am

Re: How to create a directory with miscellaneous non-Joomla files in a Joomla installation?

Post by MortenZdk » Wed Dec 25, 2019 3:46 pm

@waarnemer

Thanks for elaborating on this. I am currently the only maintainer of my Joomla homepage, so but I see that for scalability and integration the Phoca solution may be better.

So I will take a look at using Phoca for a longer term solution.

Have a nice Xmax and thanks for the feedback from everybody.

 

Post Reply

Return to “General Questions/New to Joomla! 3.x”