curl 301 moved permanently if I don't use slash at the end of the url

c4rl nginx-forum at
Tue Mar 28 16:56:13 UTC 2017


I need to list the content of some directories with curl without to use a
'/' at the end of the url.

If I do not use the slash then I receive the message below, otherwise the
content is showed. I tried many rewrite rules without success.

[user at localhost ~]$ curl

<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>

[user at localhost ~]$ curl

<head><title>Index of /data/foo/</title></head>
<body bgcolor="white">
<h1>Index of /data/foo/</h1><hr><pre><a href="../">../</a>
<a href="57581/">57581/</a>                                            
12-Jul-2016 01:56                   -
<a href="57582/">57582/</a>                                            
13-Jul-2016 01:55                   -
<a href="57583/">57583/</a>                                            
14-Jul-2016 00:34                   -

This is my vhost configuration:

server {
     listen 80;
     access_log /var/log/nginx/;
     error_log /var/log/nginx/ error;

     location /data/foo {
             alias /data/foo;
             autoindex on;

     location /data/bit {
             alias /data/bit;
             autoindex on;


Posted at Nginx Forum:,273267,273267#msg-273267

More information about the nginx mailing list