# Lowercase URLs

**URL:** <https://www.ruby-forum.com/t/lowercase-urls/222426>\
**Category:** NGINX\
**Created:** [August 28, 2012, 12:13pm UTC](https://www.ruby-forum.com/t/lowercase-urls/222426 "2012-08-28T12:13:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 28, 2012, 12:13pm UTC](https://www.ruby-forum.com/t/lowercase-urls/222426/1 "2012-08-28T12:13:00Z")

</div>

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.

Posted at Nginx Forum:

> **[Lowercase URLs](https://forum.nginx.org/read.php?2,230181,230181#msg-230181)**
>
> 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.

---

<div class="post-metadata">

**Author:** ![ShreyasPrakash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@ShreyasPrakash](https://www.ruby-forum.com/u/ShreyasPrakash)\
**Post date:** [August 28, 2012, 3:56pm UTC](https://www.ruby-forum.com/t/lowercase-urls/222426/2 "2012-08-28T15:56:15Z")

</div>

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  
[GitHub - openresty/lua-nginx-module: Embed the Power of Lua into NGINX HTTP servers · GitHub](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

---

<div class="post-metadata">

**Author:** ![ShreyasPrakash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@ShreyasPrakash](https://www.ruby-forum.com/u/ShreyasPrakash)\
**Post date:** [August 29, 2012, 1:11pm UTC](https://www.ruby-forum.com/t/lowercase-urls/222426/3 "2012-08-29T13:11:50Z")

</div>

Can’t we get this functionality without using lua-nginx-module?

Posted at Nginx Forum:

> **[Re: Lowercase URLs](https://forum.nginx.org/read.php?2,230181,230270#msg-230270)**
>
> 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.

---

<div class="post-metadata">

**Author:** ![ShreyasPrakash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@ShreyasPrakash](https://www.ruby-forum.com/u/ShreyasPrakash)\
**Post date:** [August 29, 2012, 2:45pm UTC](https://www.ruby-forum.com/t/lowercase-urls/222426/4 "2012-08-29T14:45:59Z")

</div>

On 2012-08-29 13:11, ShreyasPrakash wrote:

> Can’t we get this functionality without using lua-nginx-module?

AFAIK Nginx does support this out of the box, i.e. there’s nothing like  
the internal functions tolower/toupper of RewriteMap in Apache HTTP (see  
[mod\_rewrite - Apache HTTP Server Version 2.4](http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritemap)). If  
you prefer Perl over Lua, go with the Perl module.
