Not showing directory or files (index.html content does show up tho)

firfin

Verified User
Joined
Nov 13, 2016
Messages
21
Hi, I am having difficulty 'seeing' my files when visiting on of my domains ( example.org. It just show an empty index page, see screenshot below.
I tested if public_html was used I placed a index.html file makes the content of that file show up. So far, so good. Removed the index.html again
There are directories (e.g. 2019, 2020) in public html, these don't show up. I checked the permissions the directories have 755.
I can also point my browser to example.org/2018 and it shows up as empty as the first page. ALthough this holds directories and files as well.

I double checked the .htaccess in public_html it says Options +Indexes like recommended in https://help.directadmin.com/item.php?id=22

Now I am at a loss, what else can I do / check?


.Selection_269.png
 
Be aware that there is a public_html that points to your default domain which may not be the domain you are actually referring to. Make sure you put things in /home/<username>/domains/<domain_name>/public_html.
 
Removed the index.html again
There are directories (e.g. 2019, 2020) in public html, these don't show up.
Do you mean you want to see files? In that case you have to disable the protection. By default, open basedir (that's what it's called) is disabled.

As admin, you can enable open basedir for one or more domains, It's under PHP Setings:
 
Richard I think the open_basedir if related to running a php script. Showing the file and directory listing is Indexes.

firfin you may not be allowed to use .htaccess if the administrator has not allowed it.
 
@floyd #2 it is actually a subdomain. I am checking
/home/[myusername]/domains/[mydomainname]/public_html/documents
where document is the name of the subdomain (i.e. documents.[mydomainname])
 
So you do have files and directories in documents?
 
@Richard G #3 I have directories (which have subdirectories en files in them) I want to see those directories. Also they have to be clickable to open them and see their content, etc.
Not using php or any executable or interpreted files (semi reaction to #4 here) but tried to set the open_basedir anyway. The page you advised does not have any action button or selection tho it seems. See below.

I am also administrator, but do not know how to (dis)allow .htaccess files to be used. Where can I check that? I did not specifically set it not be allowed and other domains use .htaccess files as well.

Selection_273.png
 
Last edited:
@floyd #4 I might be able to fix this, as I am also administrator. But I am having difficulty finding out where to do this exactly.

@floyd #6, Yes I do have files there.
For instance a index.html.bak. When I remove the .bak it shows the content of the file when visiting documents.mydomain. But with the .bak extension it just shows the screenshot from #1. Besides the index.bak.html there a several directories. And a .htaccess containing only one line with 'Options +Indexes'
 
If you remove the .htaccess file what happens?
 
@floyd #9 removing .htaccess -> Forbidden You don't have permission to access this resource.

Also when restoring .htaccess I mistakenly put in 'Options Indexes' (missing the + in front of Indexes) this generates a 500 Internal server error.
So apparently the .htaccess file does get read and used.

Also adding 'IndexOptions ShowForbidden' shows
Selection_275.png
 

Attachments

  • Selection_274.png
    Selection_274.png
    9.2 KB · Views: 5
have directories (which have subdirectories en files in them) I want to see those directories. Also they have to be clickable to open them and see their content, etc.
Not using php or any executable or interpreted files (semi reaction to #4 here) but tried to set the open_basedir anyway. The page you advised does not have any action button or selection tho it seems. See below.
I'm sorry, I thought (out of my head) that by selecting the domain, it could be change individually, it's only for php, sorry for causing any confusion.

If it's not by php, but apache only, then you need to enable indexes, which you already did, so that's indeed odd. However you do only need this .htaccess 1 time in yourmain public_html so no need to put this in every directory. I don't think it will make any difference in this case.

Are you running apache or nginx or openlitespeed? As I know not all things work in .htaccess with nginx for example. Maybe floyd knows about it.

I presume you did not made any custom changes to any apache files which might cause the htaccess directory to allow all to not work correctly? No custom virtual host files or something?
I presume visiting domain.com/documents gives the same output as visiting documents.domain.com?
 
I am only an Apache guy so yes if using something else then that could be the problem.

I also find it odd that the first image shows Name Last Modified Description but the second image does not. So something is different there.

Also was the domain added as a subdomain or was it added as a regular domain?

If you put and index.html file there domain.com/documents gives the same output as visiting documents.domain.com, as Richard said?
 
@Richard G #11 No worries about the confusion here, but thanks for trying to help out!
Using apache I have an .htaccess in the main documentroot (.../documents/ ) this is also the place I am testing, once this work I agree that it will probably count in subdirectories too, but first thing first.

I do not totally get what you mean by "to allow all to not work" but no custom changes I am aware of (this is an 'inherited' installation tho. I may not know everything about it.
You're final assumption is correct, documents.domain == domain/documents
 
@floyd #13 Yes, apache.
And the difference is because I added 'IndexOptions ShowForbidden' to the .htaccess. This is the second screenshot. Without this extra line is the one in the OP.

The documents.domain was added as a subdomain.

Output from both is identical indeed, see screenshot.
Selection_276.png
 
I do not totally get what you mean by "to allow all to not work"
Yes that was a bit confusing I see. I should have used apostrophes. I ment:
to have the "allow all" (htaccess directives) not te work. But if you don't have any custom things in /usr/local/directadmin/custombuikd/custom/ap2 or the same with /extra behind it, then this can't be the cause.

Wat do you mean by "inherited installation"? A default DA installation?
Do you have a .htaccess in the public_html and if yes, what is the content?
 
@ floyd #15
Thanks for the tip, I found this in the logs, added suspicious bit in bold. This is the situation from screenshot 284, no index.html and no .htaccess
[Wed Aug 19 15:09:01.460856 2020] [autoindex:error]AH01276: Cannot serve directory /home/[myuser]/domains/[mydomain]/private_html/documents/: No matching DirectoryIndex (index.html,index.htm,index.shtml,index.php,index.php5,index.php4,index.php3,index.phtml,index.cgi,index.pl) found, and server-generated directory index forbidden by Options directive

And also in some other configuration:
[Wed Aug 19 15:12:11.663723 2020] [core:error]AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Unsure how to proceed from here.
 

Attachments

  • Selection_284.png
    Selection_284.png
    82.5 KB · Views: 6
@Richard G #16
I don't have a '/usr/local/directadmin/custombuikd/custom/ap2' dir. But '/usr/local/directadmin/custombuild/custom' DOES have a single directory suphp in it, this just contains some config for php (which is not used in this case and harmless as far as I can see).

With 'inherited' I mean I did not install this (default as far as i know) DA installation. Just managing it now. There are plenty of others sites (using htaccess also) running fine on it, set up by me AND my predecessor.

There is a .htaccess in the public_html directory! And the contents might be the culprit I suspect (although I though that .htaccess files from subdirectories overruled higher level ones...)

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php


I suspect we might be getting closer.
 
IndexIgnore in the parent directory .htaccess was indeed the culprit. In documents dir itself I overrode this using IndexIgnoreReset ON

@floyd and @Richard G Thanks so much for your patience, insight and help!

Some link for future referents:
 
Back
Top