Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

299
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda