# Problem with rewrite regexes when the URL contains a trailing slash (nginx-1.5.0)

**URL:** <https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376>\
**Category:** NGINX\
**Created:** [May 22, 2013, 8:41pm UTC](https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376 "2013-05-22T20:41:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [May 22, 2013, 8:41pm UTC](https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376/1 "2013-05-22T20:41:56Z")

</div>

Hello.  
I’m having a problem with nginx’s rewrite directive.  
Basically, when the URL contains a trailing point, it is ignored by the  
rewrite regexp.  
Let’s do an example:  
I load [http://uri/something](http://uri/something). (with the trailing point). Then, with the  
rewrite rule:  
rewrite ^/something.$ /index.html  
I should see ‘index.html’, but instead that appears in the logfile (with  
rewrite\_log set at on):  
2013/05/22 20:36:07 [notice] 6256#1440: \*57 “^/something.$” does not  
match “/something”, client: 127.0.0.1, server: localhost, request: “GET  
/something. HTTP/1.1”, host: “localhost”  
As you can see, the trailing point is missing from the “does not match”  
part of the log.

Is there any workaround for that?  
Thank you in advance,  
Robertof

---

<div class="post-metadata">

**Author:** ![fellons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ecc23a/32.png) [@fellons](https://www.ruby-forum.com/u/fellons)\
**Post date:** [May 22, 2013, 9:12pm UTC](https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376/2 "2013-05-22T21:12:55Z")

</div>

Hello!

On Wed, May 22, 2013 at 08:40:43PM +0200, Roberto F. wrote:

> 2013/05/22 20:36:07 [notice] 6256#1440: \*57 “^/something.$” does  
> not match “/something”, client: 127.0.0.1, server: localhost,  
> request: “GET /something. HTTP/1.1”, host: “localhost”  
> As you can see, the trailing point is missing from the “does not  
> match” part of the log.
> 
> Is there any workaround for that?

Are you using nginx/Windows? On Windows trailing dots and spaces  
in URIs are ignored as they aren’t significant from filesystem  
point of view and otherwise can be used to bypass access  
restrictions.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![fellons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ecc23a/32.png) [@fellons](https://www.ruby-forum.com/u/fellons)\
**Post date:** [May 22, 2013, 9:18pm UTC](https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376/3 "2013-05-22T21:18:46Z")

</div>

Hi, thanks for the fast answer!  
Yes, I am using nginx on Windows and I didn’t know about that  
restriction.  
Since the project I’m working on requires that (damned!) final point, do  
you know a way to overcome this restriction?  
For example, I thought about cygwin but I’m not sure if it would work.

Thanks again,  
Robertof

Il 22/05/2013 21:12, Maxim D. ha scritto:

---

<div class="post-metadata">

**Author:** ![fellons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ecc23a/32.png) [@fellons](https://www.ruby-forum.com/u/fellons)\
**Post date:** [May 22, 2013, 11:17pm UTC](https://www.ruby-forum.com/t/problem-with-rewrite-regexes-when-the-url-contains-a-trailing-slash-nginx-1-5-0/245376/4 "2013-05-22T23:17:24Z")

</div>

Hello – just writing again to say that I did it! I found on the web  
(just Google) a Cygwin build of nginx and it works perfectly.  
Thanks for your support!  
Robertof

Il 22/05/2013 21:12, Maxim D. ha scritto:
