LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > need a little help with redirection and expressions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2007, 04:22 AM
ts77 ts77 is offline
Senior Member
 
Join Date: Nov 2004
Posts: 288
Question need a little help with redirection and expressions

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
domain1.com/list.php?f=111
which changed to
domain2.com/list.php?111

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:
Code:
exp: ^/list.php?f=(.*)
with an external redirect and the target uri:
Code:
http://domain2.com/list.php?$1
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,

thomas
Reply With Quote
  #2  
Old 03-24-2007, 07:56 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You need to move this matching context up above the first non-matching context to give it higher priority.
The context configuration looks fine.
Reply With Quote
  #3  
Old 03-24-2007, 08:00 AM
ts77 ts77 is offline
Senior Member
 
Join Date: Nov 2004
Posts: 288
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.
Reply With Quote
  #4  
Old 03-24-2007, 08:15 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #5  
Old 03-24-2007, 12:56 PM
ts77 ts77 is offline
Senior Member
 
Join Date: Nov 2004
Posts: 288
ah, I knew I was missing the obvious .

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


thanks,

thomas
Reply With Quote
  #6  
Old 03-24-2007, 02:18 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
That's true that rewrite rule only matches URI part, however, you can deal with query-string with a rewrite condition.
Reply With Quote
  #7  
Old 03-24-2007, 03:51 PM
ts77 ts77 is offline
Senior Member
 
Join Date: Nov 2004
Posts: 288
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.


thanks,

thomas
Reply With Quote
  #8  
Old 03-24-2007, 05:36 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can use "%n" to back reference matched part from rewritecond in the final URL.
Reply With Quote
  #9  
Old 03-26-2007, 02:17 AM
ts77 ts77 is offline
Senior Member
 
Join Date: Nov 2004
Posts: 288
works like a charm.
thanks a lot!


thomas
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:23 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.