On Tue, Oct 13, 2015, at 04:59 AM, steve wrote:
> Hi folks,
> 
> I have a requirement from a customer that the terminal slash be 
> rewritten when accessing the homepage - eg example.com/ is a 301 to 
> example.com
> 
> I've tried a simple rewrite of ^/$ but that just loops.
> 
> Any ideas?
> 
> Cheers,
> 

I'm not sure what's happening in this thread, but

1.
you can't redirect example.com/ to example.com because browser is
already doing that (making request for example.com/ while showing just
example.com in address bar)


2.
to remove end slash for everything else by redirect, just use this

location ~ ^(.+)/+$ { return 301 $1; }

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to