need a little help with redirection and expressions

Discussion in 'Install/Configuration' started by ts77, Mar 24, 2007.

  1. ts77

    ts77 Well-Known Member

    Hey folks,

    I've moved some content from one subdomain to another which also changed the parameters a little bit.
    So to avoid hitting the php-code I'd like to redirect in lsws directly but I'm having trouble with using the redirect context with expressions.

    Essentially I have urls with
    which changed to

    I tried different expressions and none was successfull unfortunately. It seems to me as if I'm missing the obvious :(.

    The current expression I'm trying is:
    exp: ^/list.php?f=(.*)
    with an external redirect and the target uri:
    whats wrong with that? I'm always still getting to the old php code on the page instead of getting redirected in lsws directly.
    Oh, I'm on 2.2.6 with that machine btw.

    thanks in advance,

  2. mistwang

    mistwang LiteSpeed Staff

    You need to move this matching context up above the first non-matching context to give it higher priority.
    The context configuration looks fine.
  3. ts77

    ts77 Well-Known Member

    hmm, strange. its actually the *only* context I have in that vhost :).

    Any way to trace that? toggle debug didn't give me any output beside the admin-vhost.
  4. mistwang

    mistwang LiteSpeed Staff

    I just realized There is a problem with your matching URI, it does not include query sting when matching the expression.

    So, in this case, you have to use a Rewrite rule for this.
  5. ts77

    ts77 Well-Known Member

    ah, I knew I was missing the obvious ;).

    but AFAIK rewrite engine also doesn't match on the query-string or am I wrong?


  6. mistwang

    mistwang LiteSpeed Staff

    That's true that rewrite rule only matches URI part, however, you can deal with query-string with a rewrite condition. :)
  7. ts77

    ts77 Well-Known Member

    to match it yeah but I don't get a part of the query string in a variable I guess ;).

    Seems like I'm doomed to use some script engine to handle that sanely.


  8. mistwang

    mistwang LiteSpeed Staff

    You can use "%n" to back reference matched part from rewritecond in the final URL.
  9. ts77

    ts77 Well-Known Member

    works like a charm.
    thanks a lot!


Share This Page