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

mat h mat999 at gmail.com
Sun Sep 12 05:42:56 MSD 2010


 rewrite ^(.*/)index.html http://$host$1 permanent;

On Sun, Sep 12, 2010 at 11:39 AM, ez77 <nginx-forum at nginx.us> wrote:
>> At the risk of pushing it... is there a way to make the redirect 301
> rather than 302?
>
> In case anybody is interested, the following code (very similar to the
> original I found elsewhere) works OK in the latest version, 0.8.50, with
> a 301 response:
>
>      location / {
>            root   /var/www/mysite;
>            index  index.html index.htm;
>            if ($request_uri ~ (.*/)index.html) {
>            set $files $1;
>            rewrite ^ http://$host$files permanent;
>            }
>        }
>
>
> By now I don't even know if I tried this exactly with an older
> version... certainly something like this, but it didn't work.
>
> Cheers!
>
> Ezequiel
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,128951,129630#msg-129630
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list