• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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