# Url rewriting problem with rails 1.2.3

**URL:** <https://www.ruby-forum.com/t/url-rewriting-problem-with-rails-1-2-3/90544>\
**Category:** Rails\
**Created:** [March 29, 2007, 8:56pm UTC](https://www.ruby-forum.com/t/url-rewriting-problem-with-rails-1-2-3/90544 "2007-03-29T20:56:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hansdons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/fbc32d/32.png) [@hansdons](https://www.ruby-forum.com/u/hansdons)\
**Post date:** [March 29, 2007, 8:56pm UTC](https://www.ruby-forum.com/t/url-rewriting-problem-with-rails-1-2-3/90544/1 "2007-03-29T20:56:16Z")

</div>

Very frustrated. I recently upgraded from earlier Rails version to new  
one (1.2.3). On the new version Rails (or webrick, not sure) messes up  
or rewrites incorrecly a url provided by javascript:

I have a simple piece of javascript, firing on an image click that  
loads a document in an i frame. The url navigation code is simply:  
window.location.href = “[http://localhost:3000/login/messages](http://localhost:3000/login/messages)” .  
(machine name:port name is variable of course) Rails then (used to for  
last 6 months)  
call the ‘messages’ method on the ‘login’ controller, which then ‘does  
its thing’. Always worked perfectly. No matter how many times I click  
the relevant image the same controller method ‘messages’ is called and  
everything works perfectly. Now Rails(version 1.2.3) somehow generates  
the following url: “[http://localhost:3000/login/login/messages](http://localhost:3000/login/login/messages)” which  
results in rails thinking ‘messages’ is an id an ‘login’ a controller  
method. From the javascript I definitely DO NOT give it this url + I  
do not do anything further with it- including the server side. Just  
before the ‘window.location.href =’ part, I use an alert to check the  
url and it is correct. So this is my problem. I also discovered that  
if I click it again, the login part is appended again, i.e it becomes  
“[http://localhost:3000/login/login/login/messages](http://localhost:3000/login/login/login/messages)”. The exact same  
code that works previously does not now. The only problem is the fact  
that, without my intervention a url becomes something else. I know it  
is not a browser issue.  
So if anyone can help, it would be great. It would also be useful for  
me to find webrick’s log file. Where is it stored on windows?

---

<div class="post-metadata">

**Author:** ![hansdons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/fbc32d/32.png) [@hansdons](https://www.ruby-forum.com/u/hansdons)\
**Post date:** [March 29, 2007, 9:26pm UTC](https://www.ruby-forum.com/t/url-rewriting-problem-with-rails-1-2-3/90544/2 "2007-03-29T21:26:35Z")

</div>

I solved the problem: the url generated by javascript was “login/  
messages” instead of “/login/messages” . (the machine\_name and  
portname was left out). The older version of Rails was just more  
‘forgiving’
