# Re: Rewrite

**URL:** <https://www.ruby-forum.com/t/re-rewrite/244418>\
**Category:** NGINX\
**Created:** [April 7, 2016, 3:42am UTC](https://www.ruby-forum.com/t/re-rewrite/244418 "2016-04-07T03:42:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [April 7, 2016, 3:42am UTC](https://www.ruby-forum.com/t/re-rewrite/244418/1 "2016-04-07T03:42:41Z")

</div>

Thank you Francis. It is working now.

Sent from my Samsung device

-------- Original message --------  
From: Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: 06/04/2016 07:48 (GMT+08:00)  
To: removed\_email\_address@domain.invalid  
Subject: Re: Rewrite

On Tue, Apr 05, 2016 at 08:11:44PM +0900, tseveendorj wrote:

Hi there,

> request URL is [http://domain.com/x4Zbs5B](http://domain.com/x4Zbs5B)  
> It should be [Domain.com](http://domain.com/index.php?download=x4Zbs5B)
> 
> I tried  
> location / {  
> rewrite ^/([^/][a-zA-Z0-9]+)$ /index.php?download=$1 break;

I’m not sure that the four characters “[^/]” are doing anything useful  
on that line.

I am sure that “break” is not what you want there. Just remove it.

> ```
> try_files $uri $uri/ /index.php?download=$uri;
> }
> 
> ```
> 
> but it is downloading index.php file itself 😃

Presumably somewhere else in your config you tell nginx how to handle  
/index.php?

## f

Francis D. removed\_email\_address@domain.invalid
