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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > rewrite redirect not working under 3.3.24

Reply
 
Thread Tools Display Modes
  #1  
Old 01-31-2009, 03:29 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
Question rewrite redirect not working under 3.3.24

This used to work and I just noticed under 3.3.24 it's no longer working:

RewriteCond %{HTTP_HOST} !^websitename\.com
RewriteRule ^(.*)$ http://websitename.com/$1 [L,R]

(it's to enforce no-www on URLs)

Works fine under apache, used to work under Litespeed.
Did something break?
Reply With Quote
  #2  
Old 01-31-2009, 04:32 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Please enable rewrite log with "RewriteLogLevel 9" for that vhost.
It should not be affected.
Reply With Quote
  #3  
Old 01-31-2009, 05:54 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
Okay I did that (by the way, it would be nice if that worked from .htaccess as well, though I guess it would be a security issue as it could overflow the logs)

but there are no errors, only this info line, when I access it with www.websitename.com (it should be redirected to websitename.com but it's not)

2009-01-31 20:49:48.900 INFO [12.34.56.78:2594-4#APVH_websitename.com] [REWRITE] Cond: Match 'websitename.com' with pattern '^websitename\.com', result: 1

Last edited by aww; 01-31-2009 at 05:56 PM..
Reply With Quote
  #4  
Old 01-31-2009, 06:14 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
Hmm, wait now I see

12.34.56.78:2822-1#APVH_websitename.com] [REWRITE] Cond: Match 'www.websitename.com' with pattern '^websitename\.com', result: -1

So that's false, then there's a ! in front of it to negate it and that should be true.

But it doesn't seem to ever execute the redirect.
Reply With Quote
  #5  
Old 01-31-2009, 07:45 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
I tried a similar rule with http://www.store.litespeedtech.com, it works.
Reply With Quote
  #6  
Old 01-31-2009, 08:04 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
I tried something in a different directory that had no other rules and yes it works.

But that means a lower level rule is interfering with a higher level rule which should not happen.

the .htaccess in the webroot should execute first, before any in a sub-directory, no?

keep in mind it works on apache - I will have to look at this line by line now to debug
Reply With Quote
  #7  
Old 01-31-2009, 08:17 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
Yup with JUST that rule in the webroot, some lower level rules which have nothing to do with external redirects, only internal rewrites, screw it up - it never redirects.

I'll try to come up with a minimal example.
Reply With Quote
  #8  
Old 01-31-2009, 08:23 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
I have found the bug, and it is real.

All it takes is for a sub-directory to have the directive:

RewriteEngine On

in it's own sub .htaccess, and the parent redirect will never happen.
No other rule is present in the subdirectory.
If I remove that RewriteEngine On - the redirect will work properly, even with other rules.

Apparently "RewriteEngine On" causes the rewrite engine in litespeed to reset.
This is not the behaviour in apache, which will ignore it if it's already on.

Try making a sub-directory called /testing123/
and make a .htaccess in it
and put in the .htaccess
RewriteEngine On

then go to
Code:
www.store.litespeedtech.com/testing123/
and it will NOT redirect to the URL without the www.

Last edited by aww; 01-31-2009 at 08:27 PM..
Reply With Quote
  #9  
Old 02-01-2009, 07:43 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
we will investigate.
Reply With Quote
  #10  
Old 02-13-2009, 03:15 PM
aww aww is offline
Senior Member
 
Join Date: May 2007
Posts: 237
Was anything discovered about this?
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 08:13 PM.



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