Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

300
Vistas
execute script when directory listing by .htaccess

I have a http server (apache HTTPD v2.4) where directory listing is enabled. I configured it to use the 'fancy-index' from https://github.com/Vestride/fancy-index, and works great. However, its searching function didn't give what I was looking for.

I'd like to configure the webserver such that if I goto http://mywebserver.com/someDir/*?list, it will return a list of all the files in someDir in a "file, filesize" format.

Or, if I goto http://mywebserver.com/someDir/essay2020*.txt?list , I'll get a custom list of all essay2020*.txt files. Or some form of a simple regex: say "essay2020[0-2]*.txt".

I can write a php/perl/python script that can read a directory and return the 'file, filesize' list. But how do I configure the .htaccess to call this script? Do I have to muck around with 'RewriteRule'? or something special?

As an added note, I'm not limited to modifying .htaccess only. If I can do all of this by modifying the httpd.conf, I'm open to that suggestion too.

Thanks.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The answer in Comments by CBroe did it. By just modifying the apache2.conf file to add:

        RewriteEngine on
        RewriteCond %{QUERY_STRING} ^list$
        RewriteRule .* /search.php?path=%{REQUEST_URI}

within my <VirtualHost>, I'm now able to forward everything to search.php, where there I can parse and do what needs to be done. All w/o revealing search.php's existence. Thanks.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda