Add slash to the base url

Prateek Dayal lists at ruby-forum.com
Wed Mar 31 17:34:51 MSD 2010


Hi,

I am trying to add a trailing slash to every url and I have been able to
[almost] achieve that with this rule

if ($request_method ~* get){
  rewrite ^(.*[^/])$ $1/ permanent;
}

The if condition is to prevent redirection of POST requests to GET
requests. Urls such as http://localhost/anything are redirected to
http://localhost/anything/ but I am not able to redirect
http://localhost to http://localhost/

Am I missing something?

Thanks
Prateek Dayal
-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list