# Rewrite url seo

**URL:** <https://www.ruby-forum.com/t/rewrite-url-seo/188075>\
**Category:** NGINX\
**Created:** [May 5, 2010, 11:18am UTC](https://www.ruby-forum.com/t/rewrite-url-seo/188075 "2010-05-05T11:18:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlstar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@jlstar](https://www.ruby-forum.com/u/jlstar)\
**Post date:** [May 5, 2010, 11:18am UTC](https://www.ruby-forum.com/t/rewrite-url-seo/188075/1 "2010-05-05T11:18:04Z")

</div>

I want to improve my urls for seo

I’m with rails attachment\_fu

I want change this url

/attachments/000/234/my\_great\_image.jpg

like that :

/my\_keywords\_seo/images/my\_great\_image.jpg

I tried it

location ~\* ^/attachments { rewrite  
^/attachments/([0-9]+)/([0-9]+)/(.\*)$ /my\_keywords\_seo/images/$3 last; }

the url is rewritten, however, the resource is not found !

However i read in [Module ngx\_http\_rewrite\_module](http://wiki.nginx.org/NginxHttpRewriteModule)

Flags can be any of the following:  
last - completes processing of rewrite directives, after which searches  
for corresponding URI and location

I don’t understand …

Somebody can help me ?

---

<div class="post-metadata">

**Author:** ![jlstar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@jlstar](https://www.ruby-forum.com/u/jlstar)\
**Post date:** [May 5, 2010, 2:28pm UTC](https://www.ruby-forum.com/t/rewrite-url-seo/188075/2 "2010-05-05T14:28:28Z")

</div>

or maybe I did not understand the documentation for “last” my goal is  
the url change, but once the resource has been provided … just a url  
rewrite not redirecting … someone has the answer ?

---

<div class="post-metadata">

**Author:** ![jlstar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@jlstar](https://www.ruby-forum.com/u/jlstar)\
**Post date:** [May 6, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/rewrite-url-seo/188075/3 "2010-05-06T19:10:41Z")

</div>

nobody ?
