• Inviting everyone who uses WordPress management tools in Plesk
    The Plesk team is conducting a 60-minute research session that includes an interview and a moderated usability test.
    To participate, please use this link .
    Your experience will help shape product decisions and ensure the tools better support real-world use cases.

How to have directory indexing on subdomains [SOLUTION]

C

chillax

Guest
The problem:

Quite an annoyance that Plesk does not allow directory indexing on the root of your subdomains.
For example if you wanted to have directory indexing on sub.mydomain.com/ you cannot simply create an htaccess file with Options +Indexes and expect it to work.


The solution:

Here is what I put together, I welcome feedback from others on an easier/better way to achieve the end result.

1. Create a directory in your subdomain (ex: sub.mydomain.com/files/).

2. Move your files that you want indexed from the root directory to the one you just created.

3. Create an .htaccess inside the directory you just created and put the following text in it:
Code:
Options +Indexes
4. Create an .htacces file in your root directory and put the following text in it:
Code:
RewriteEngine On

RewriteRule ^$ /files/ [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*) /files/$1 [L]
5. Test it out by going to sub.mydomain.com and see if it shows you the directory listing of the files directory.
 
Like a charm (directory listing)

Should be an easier way but it works!.
 
Back
Top