# Rewrite - html files without ARGS

**URL:** <https://www.ruby-forum.com/t/rewrite-html-files-without-args/199654>\
**Category:** NGINX\
**Created:** [November 25, 2010, 8:11pm UTC](https://www.ruby-forum.com/t/rewrite-html-files-without-args/199654 "2010-11-25T20:11:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 25, 2010, 8:11pm UTC](https://www.ruby-forum.com/t/rewrite-html-files-without-args/199654/1 "2010-11-25T20:11:06Z")

</div>

Hello,

I wanted to rewrite this url

news/any\_file-name-1-9?utm\_source=feedburner&utm\_medium=feed&utm\_campaign=Feed%3A+homeinteriors+(Design+Interior)

To

news/any\_file-name-1-9.html

I wrote

* * *

location = /news {  
if ($args ~ ^ utm\_source) {  
set $args “”;  
}  
}

* * *

OR

* * *

location ~\* ^.+.(htm|html)$ {  
if ($args != “”) {  
set $args “”;  
}

* * *

But it doesn’t work

Can anyone help me? Let me know what I’m doing wrong 😕

Posted at Nginx Forum:

> **[Rewrite - html files without ARGS](https://forum.nginx.org/read.php?2,153328,153328#msg-153328)**
>
> Hello, I wanted to rewrite this url news/any\_file-name-1-9?utm\_source=feedburner&utm\_medium=feed&utm\_campaign=Feed%3A+homeinteriors+(Design+Interior) To news/any\_file-name-1-9.html I wrote \*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![stk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@stk](https://www.ruby-forum.com/u/stk)\
**Post date:** [November 25, 2010, 9:27pm UTC](https://www.ruby-forum.com/t/rewrite-html-files-without-args/199654/2 "2010-11-25T21:27:04Z")

</div>

On Thu, Nov 25, 2010 at 02:09:50PM -0500, stk wrote:

> location ~\* ^.+.(htm|html)$ {  
> if ($args != “”) {  
> set $args “”;  
> }
> 
> * * *
> 
> But it doesn’t work
> 
> Can anyone help me? Let me know what I’m doing wrong 😕

location /news/ {  
location ~ ^/news/(.+)$ {  
alias /path/to/files/$1.html;  
}  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
