# Help: My rewriting does not work

**URL:** <https://www.ruby-forum.com/t/help-my-rewriting-does-not-work/212191>\
**Category:** NGINX\
**Created:** [September 25, 2011, 7:04am UTC](https://www.ruby-forum.com/t/help-my-rewriting-does-not-work/212191 "2011-09-25T07:04:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 25, 2011, 7:04am UTC](https://www.ruby-forum.com/t/help-my-rewriting-does-not-work/212191/1 "2011-09-25T07:04:03Z")

</div>

I want to rewrite an old page to a new location, I use this code:

rewrite ^/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html /w/新页面 permanent;

But it does not work. I still can open the old page from  
[http://mysite.com/����Ѩλͼ.html](http://mysite.com/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html), not being  
redirected to the new location.

Can you help me correct my rewriting code? Thanks.

Posted at Nginx Forum:

> **[Help: My rewriting does not work.](https://forum.nginx.org/read.php?2,215776,215776#msg-215776)**
>
> I want to rewrite an old page to a new location, I use this code: rewrite ^/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html /w/新页面 permanent; But it does not work. I still can open the old page from http://mysite.com/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html, not...

---

<div class="post-metadata">

**Author:** ![ohjyops](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/bbe5ce/32.png) [@ohjyops](https://www.ruby-forum.com/u/ohjyops)\
**Post date:** [September 26, 2011, 2:16am UTC](https://www.ruby-forum.com/t/help-my-rewriting-does-not-work/212191/2 "2011-09-26T02:16:48Z")

</div>

you may need to using ^/人体穴位蛙.html /w/新页面 permanent;

note: You need save the file at ASCII mode for match GBK charset. But  
I am not share may it work for this.

2011/9/25 ohjyops [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Posted at Nginx Forum:  
> [http://forum.nginx.org/read.php?2,215776,215776#msg-215776](http://forum.nginx.org/read.php?2,215776,215776#msg-215776)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

–  
MagicBear

---

<div class="post-metadata">

**Author:** ![ohjyops](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/bbe5ce/32.png) [@ohjyops](https://www.ruby-forum.com/u/ohjyops)\
**Post date:** [September 26, 2011, 6:19am UTC](https://www.ruby-forum.com/t/help-my-rewriting-does-not-work/212191/3 "2011-09-26T06:19:59Z")

</div>

Thank you for your reply.  
I tried:  
^/人体穴位蛙.html /w/新页面 permanent;  
But it did not work. ( I did not covert the file to ASCII mode, It is  
UTF8)

My nginx configuration file was saved in UTF8 encoding. The name of the  
old page file is a unescaped form of “人体穴位图.html” in GBK  
encoding. I converted my old website system from GBK encoding to a new  
UTF8 encoding one, and I use a new location /w/新页面 to replace the  
old “/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html”.

Here is the related part of my conf file:  
server {  
…  
charset utf-8;  
source\_charset utf-8;  
…  
location ~ .html$ {  
rewrite ^/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html /w/新页面 permanent;  
}  
}

What words will “/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html” be translated by  
nginx? How can I catch the path and rewrite it to the new location?

If I covert my nginx conf file to ASCII encoding, will my new site  
system (in UTF8 encoding) still work?

Posted at Nginx Forum:

> **[Re: Help: My rewriting does not work.](https://forum.nginx.org/read.php?2,215776,215824#msg-215824)**
>
> I want to rewrite an old page to a new location, I use this code: rewrite ^/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html /w/新页面 permanent; But it does not work. I still can open the old page from http://mysite.com/%C8%CB%CC%E5%D1%A8%CE%BB%CD%BC.html, not...
