Multiple redirects on lighttpd

0

I have a request to redirect multiple individual URLs to new individual URLs. This is the situation:

**Old URL                         -->     New URL**
old.domain.org/                   -->  new.domain.net/inf/site1.html
old.domain.org/#data/re/sys.html  -->  new.domain.net/inf/site2.html 
old.domain.org/#data/rq/opr.html  -->  new.domain.net/inf/site3.html

I created a redirect file with this code:

$HTTP["host"] == "old.domain.org" {
       url.redirect = ("^/$" => "http://new.domain.net/inf/site1.html",
       "^/#data/re/sys.html" => "http://new.domain.net/inf/site2.html",
       "^/#data/rq/opr.html" => "http://new.domain.net/inf/site3.html"
       )
}

But this does not work for me; because, when i go to http://old.domain.org/#data/re/sys.html the lighttpd redirect to http://new.domain.net/inf/site1.html#data/re/sys.html ... that does not exist.

I'm not developer, but I think that the problem is the "#" character.. someone said me that thats part is a javascript function. So, how I do to go to old urls to the new urls?

the0

Posted 2015-11-10T04:08:52.417

Reputation: 1

you are correct. lighttpd never sees the # or anything after it, that is all handled on the client side. so, the short answer is you can't do it with just lighttpd. – heavyd – 2015-11-10T04:14:30.310

how i could do it? lighttpd and what else? – the0 – 2015-11-10T05:33:22.147

I would suggest taking this question over to http://serverfault.com or http://webmasters.stackexchange.com (flag the question for moderator attention, and just put a note that you'd like it moved.). The folks over there have probably run into this problem before.

– heavyd – 2015-11-10T06:42:01.383

Answers

0

I have no experience with lighttpd but at a guess you might try URL perecent encoding, since # is a reserved character in URLs.

Try replacing #data with %23data.

Anaksunaman

Posted 2015-11-10T04:08:52.417

Reputation: 9 278