Beginner's question: redirecting /dir/index.html to /dir/

ez77 nginx-forum at nginx.us
Fri Sep 10 02:22:23 MSD 2010


Greetings,

I'm trying to send all .../dir/index.html requests to .../dir/ . I
looked this up in forums but I'm only able to do it for the root
directory:

[code]
location / { 
    root   /var/www/mysite;
    index  index.html index.htm;
    if ($request_uri = /index.html) {
    rewrite ^ http://$host? permanent;
    }   
}
[/code]

Some day I'll try to stop this copy-and-paste madness, but "in the
meantime"... could someone please give me a hand? I would greatly
appreciate it.

Thanks and cheers,

Ezequiel

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,128951,128951#msg-128951




More information about the nginx mailing list