Lowercase URLs

Christoph Schug chris+nginx at schug.net
Tue Aug 28 13:55:39 UTC 2012


On 2012-08-28 11:30, ShreyasPrakash wrote:
> Hi,
>
> I would like to know how to convert the URLs to lowercase. When 
> somebody
> hits an URL ( irrespective of the case ), it should be converted to
> lowercase in the address bar.

With the help of lua-nginx-module (see 
https://github.com/chaoslawful/lua-nginx-module)
it could look like this ...

location ~ "\p{Lu}" {
     rewrite_by_lua 'return ngx.redirect(string.lower(ngx.var.uri), 
ngx.HTTP_MOVED_PERMANENTLY)';
}

-cs



More information about the nginx mailing list