Beginner's question: redirecting /dir/index.html to /dir/
Igor Sysoev
igor at sysoev.ru
Fri Sep 10 23:50:12 MSD 2010
On Fri, Sep 10, 2010 at 12:51:52PM -0400, ez77 wrote:
> Thank you all for your replies. It's indeed an honor to receive help
> from the very creator of nginx! Not meaning to bug any of you any
> more... but this last configuration,
>
> location / {
> root /var/www/mysite;
> index index.html;
> }
>
> location ~ ^(/.+/)index.html$ {
> internal;
> error_page 404 http://$host$1?;
> }
>
> , redirects to the root of my site: site.com/ instead of site.com/dir/.
> To be precise, to site.com/? . (What's the point of that "?"?)
Sorry, this "?" is usefull in "rewrite"s only.
Upgrade to the lastest 0.8.50 and try
location ~ ^(?<DIR>.*/)index.html$ {
internal;
root /var/www/mysite;
error_page 404 http://$host$DIR;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list