Sunday, 15 May 2011

rewrite - Trying to figure out lighttpd and rewriting URLs -


So I have a website that uses a system like this:

Domain.com/? Page = 123

I have to display in this form:

domain.com/123

I have Has 4 virtual hosts, so I want to apply one of these to them.

My virtualhost setup is as follows:

  $ HTTP ["host"] = ~ "(^ | \) domain 1 \ .org $" {-settings -} $ HTTP ["host"] = ~ "(^. \.) Domain 2 \ .org $" {-settings-}   

I have no clue and already Have tried to search.

Thanks in advance.

  url.rewrite-once = ("^ / (. *) $ "= & Gt;" / / page = $ 1 ")   

which is a regular expression, before the line ^ before / after that anything matches . * , and hold it at the end of the line $ in a subexpression (. *) to /? Page = & lt; T because it is within the $ HTTP ["host"] block, it will only apply to a specific host.

Edit: Example log

  2013-06-21 12:07:52: (response.c.300) - Partition Request-URI 2013-06-21 12:07:52: (Response C..301) Request-URI: / 123 2013-06-21 12:07:52: (Response 0.302) URI-Scheme: http: 2013-06-21 12:07: 52: (Reaction.3.303) URI-Authority: rewrite.example.com 2013-06-21 12:07:52: (response.c.304) URI-Path: / 123 2013-06-21 12:07:52 : (Response.c.305) URI-query: 2013-06-21 12:07:52: (response.c.300) - Partition Request-URI 2013-06-21 12:07:52: (response.c .301) Request - URI: /? Page = 123 2013-06-21 12:07:52: (response. C.302) URI-scheme: http: 2013-06-21 12:07:52: (response. C.303) URI-authorization: rewrite .example.com 2013-06-21 12:07:52: (response.c.304) URI-path: / 2013-06-21 12:07:52: (response. C.305) URI-query: page = 123   

In this example, / 123 to /? Page = 123 and we see the reque /? Resume on page = 123

No comments:

Post a Comment