Windex by David DeSandro makes apache's file indexes for directories without a default document look much nicer. Read nclud's excellent intro post to find out more about windex, as introducing it again here would be unnecessary.

The problem with Windex living under the host's webroot directory is that it makes the windex directory available in the list. I understand that you can work around this, but what I really wanted was a shared install that I could use across all the virtual hosts on my server - here is how I achieved it with Ubuntu server 10.04 LTS under apache2. It's worth noting that this is only really worth doing if you have full control of the server (for internal projects/servers maybe) since it involves modifying the apache config settings for hosts.

First, extract the windex directory from the distribution zip download to somewhere away from your webroot. I chose to use  /usr/share/windex, but I don't think this matters too much. Be careful that it's actually the directory within the zip file that needs to be extracted, so in my example /usr/share/windex contains config.php, header.php etc, but not a directory called windex

Next, in the <VirtualHost> declaration for your host in /etc/apache2/sites-available add an alias for windex:

Alias /windex "/usr/share/windex"
<Directory /usr/share/windex>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
</Directory>

A slight modification to config.php is necessary, because it is assumed that the files used for markdown and textile markup will be in the DocumentRoot for the host, which they're not. Lines 80 and 84 both need changing so that they do not reference an absolute path (and therefore are found in the current directory in which config.php resides) - change lines 80 and 84 from:

80                 require_once( $_SERVER["DOCUMENT_ROOT"]. $windexPath . '/textile.php');
84                 require_once( $_SERVER["DOCUMENT_ROOT"]. $windexPath . '/markdown.php');

to:

80                 require_once( 'textile.php');
84                 require_once( 'markdown.php');

Finally, copy the main.htaccess file from the windex distribution zip file root to your document root, and follow the instructions that come with the distribution for merging it with your existing .htaccess file.

For each additional virtual host you define for apache, all that's needed is to create the alias in the apache config file, and perform the (main).htaccess merging or copying again, and if windex is updated (or you want to expand/change it in any way) it's only necessary to do it once for all hosts.

Comments (0)


This thread has been closed from taking new comments.

Featured

GPlusMODX

Google+ Utilities and plugins for the MODX CMS

Read more

Windex shared installation

Setting up David DeSandro's Windex for multiple virtual hosts on apache/linux

Read more

Links