Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Listing a directory content with ls -l shows this output:

total 12
drwxr-xr-x 3 root root 4096 Dec 11 16:38 2.3
drwxr-xr-x 5 root root 4096 Dec 11 16:38 2.4
drwxr-xr-x 2 root root 4096 Dec 11 16:38 archive
lrwxrwxrwx 1 root root   10 Dec 11 16:38 current -> 2.4/2.4.1/
lrwxrwxrwx 1 root root   10 Dec 11 16:38 next -> 2.4/2.4.2/
lrwxrwxrwx 1 root root   10 Dec 11 16:38 previous -> 2.4/2.4.0/

Notice how it shows the symbolic links and their respective targets.

I need to know if there is a way of getting the same behaviour in apache directory browsing.

If apache is not capable of it as I suspect, is there an application (FLOSS) providing that kind of behaviour ?

share|improve this question

2 Answers 2

I looked for a solution to this problem in the context of a continuous delivery pipeline. In the binary repository management, versions evolve this way between stages : beta -> rc -> stable.

I use Apache 2.2 to access binary from any server. I decided to use the apache Index description field.

Here is my setup :

1 ) Add fancy indexing in the virtual host config file (ie. /etc/apache2/site-available/my- vhost )

<VirtualHost *: 80 >
...
  DocumentRoot /path/to/root
  IndexOptions FancyIndexing
...
</ VirtualHost>

2) create a .htaccess file in the root directory (path/to/root) containing symbolic links.

#              $version   $lifecycle
AddDescription "2.10.0.5" beta
AddDescription "2.10.0.4" rc
AddDescription "2.9.0.9" stable

3) Then use SSH + sed to replace " infile " the version number : here is an example for the beta,

ssh user@server "cd /path/to/root; sed -i 's/AddDescription.*$lifecycle$/AddDescription \"$version\" $lifecycle/g' .htaccess" && {
  echo "Success."
} || {
  echo "Failed.";
}

Of course this requires some scripting but this solution is sufficiently dynamic to me. .htaccess is taken into account dynamically by Apache.

The target of the symlink is printed under the description column.

Hope this help.

share|improve this answer

This should be possible with the mod_autoindex options.

Take a look at the options IndexOptions and IndexStyleSheet here.

share|improve this answer
    
Seems there is no such option/no simple way of doing this. –  Erwan Queffélec Dec 12 '12 at 10:10
    
I think that exactly the same behavior as your ls -l output is not possible with mod_autoindex, but you can take a look at github.com/eigan/Apache-Autoindex-Style for a easy way to improve the original directory listing design. Hope this helps you anyways. –  morlix Dec 12 '12 at 13:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.