unescaping character in url

Fr Tr lists at ruby-forum.com
Sat Oct 24 18:46:07 MSD 2009


Hi all,

I have a problem trying to rewrite a URL.

It should be pretty straightforward but it has been taking me hours
searching.

Google indexed urls containing ";", which gets escaped to %3B:

http://server.com/plan/52%3Bjsessionid=A9594B224FF913C1A1AB83B0368C1581
(the original url that works is
http://server.com/path/52;jsessionid=A9594B224FF913C1A1AB83B0368C1581)

First approach was:
server {

location /plan/ {
  rewrite /plan/(.*)%3Bjsessionid=[A-Za-z0-9]+(.*)
http://www.server.com/plan/$1$2 permanent;
}
(...)
}

but no dice, I get errors because it tries to fetch a file from disk (!)
/usr/local/nginx/html/plan/52" failed (2: No such file or directory),

Just to test I tried also with

if ($args ^~ jsessionid){
  rewrite ^ http://example.com/ permanent;
}

...but it doesn't like the ^~ which btw means the wiki for
NginxHttpRewriteModule is outdated for 0.6.29.

My question is: how can I simply do a rewrite to replace "%3B" to ";" ?

Thanks!

Francisco
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list