# Possible to rewrite based on referring url?

**URL:** <https://www.ruby-forum.com/t/possible-to-rewrite-based-on-referring-url/190760>\
**Category:** NGINX\
**Created:** [June 26, 2010, 11:51pm UTC](https://www.ruby-forum.com/t/possible-to-rewrite-based-on-referring-url/190760 "2010-06-26T23:51:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricIsGood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a4c791/32.png) [@EricIsGood](https://www.ruby-forum.com/u/EricIsGood)\
**Post date:** [June 26, 2010, 11:51pm UTC](https://www.ruby-forum.com/t/possible-to-rewrite-based-on-referring-url/190760/1 "2010-06-26T23:51:01Z")

</div>

here is an example called url:  
[http://myserver.com/index.php?id=15](http://myserver.com/index.php?id=15)

I would like to change the id= based on referrer…

so I will have a list of referers…

if referer url contains moo/cow.php then rewrite to:  
[http://myserver.com/index.php?id=15](http://myserver.com/index.php?id=15)

if referer url contains milk/cookies.php then rewrite to:  
[http://myserver.com/index.php?id=16](http://myserver.com/index.php?id=16)

Thanks,

-Eric

Posted at Nginx Forum:

> **[possible to rewrite based on referring url?](https://forum.nginx.org/read.php?2,102778,102778#msg-102778)**
>
> here is an example called url: http://myserver.com/index.php?id=15 I would like to change the id= based on referrer.... so I will have a list of referers.... if referer url contains moo/cow.php then rewrite to: http://myserver.com/index.php?
