Difference between revisions of "Displaying Directory Contents In A CS Webpage"
Line 1: | Line 1: | ||
− | Some CS users want to display the contents of a directory (located under their ''public_html'' directory), however, CS has directory indexes disabled sitewide (to prevent people from inadvertently disclosing files by accident). | + | :Some CS users want to display the contents of a directory (located under their ''public_html'' directory), however, CS has directory indexes disabled sitewide (to prevent people from inadvertently disclosing files by accident). |
− | But, you can still display the contents of the directory using one of two methods: | + | :But, you can still display the contents of the directory using one of two methods: |
==Method 1: Using an ''index.html'' File== | ==Method 1: Using an ''index.html'' File== | ||
− | + | Y:ou can create an index.html file that contains links to the contents of the directory. | |
==Method 2: Using a ''.htaccess'' File== | ==Method 2: Using a ''.htaccess'' File== | ||
− | You can add a '''.htaccess''' (don't forget the '''.''' ) file to the directory with the following contents: | + | :You can add a '''.htaccess''' (don't forget the '''.''' ) file to the directory with the following contents: |
<pre> | <pre> | ||
Line 15: | Line 15: | ||
</pre> | </pre> | ||
− | Make sure your '''.htaccess''' file has 604 permissions, just like [[File Permissions for Webpages|all other CS webpages need]]. If in doubt: | + | :Make sure your '''.htaccess''' file has 604 permissions, just like [[File Permissions for Webpages|all other CS webpages need]]. If in doubt: |
chmod 604 .htaccess | chmod 604 .htaccess | ||
− | The settings in a '''.htaccess''' file apply to the directory it is in and to any of its subdirectories (recursively). | + | :The settings in a '''.htaccess''' file apply to the directory it is in and to any of its subdirectories (recursively). |
[[Category:Webpages and Webservices]] | [[Category:Webpages and Webservices]] |
Revision as of 14:13, 15 March 2017
- Some CS users want to display the contents of a directory (located under their public_html directory), however, CS has directory indexes disabled sitewide (to prevent people from inadvertently disclosing files by accident).
- But, you can still display the contents of the directory using one of two methods:
Method 1: Using an index.html File
Y:ou can create an index.html file that contains links to the contents of the directory.
Method 2: Using a .htaccess File
- You can add a .htaccess (don't forget the . ) file to the directory with the following contents:
Options +Indexes
- Make sure your .htaccess file has 604 permissions, just like all other CS webpages need. If in doubt:
chmod 604 .htaccess
- The settings in a .htaccess file apply to the directory it is in and to any of its subdirectories (recursively).