Rewrite broken

justme

Well-Known Member
#1
Hello,
after upgrading to LSWS 3.3.18 (from 3.3.15) on linux 32bit,
the following rewrite rules used on Joomla stopped working:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ / [F,L]

Actually no 404 but going back to the homepage so it may have to do with some variables not being defined as with the previous version?
Anyway I removed the 3.3.15 from the version management a bit too fast, how I can put it back to revert and see how it helps?
Thanks.
 

mistwang

LiteSpeed Staff
#2
Can you turn on RewriteLog and check the error.log?

Actually, there is a change in 3.3.17 which affect PHP environment variables, PHP_SELF, SCRIPT_NAME. It should not affect rewrite rules.
 

justme

Well-Known Member
#5
The 3.3.15 folder is still there but not showing on the version manager (kind of normal since I had clicked on remove).
Joomla is being used with the 404Sef SEO url optimization module, turning it off solves the problem.
[REWRITE] Rule: Match '/100-laine-vierge' with pattern '(.*)', result: 2
[REWRITE] Cond: Match '/100-laine-vierge' with pattern '^(/component/option,com)', result: -1
[REWRITE] Cond: Match '/100-laine-vierge' with pattern '(/|\.htm|\.php|\.html|/[^.]*)$', result: 2
[REWRITE] stat( /home/www/xyz.com/laine/100-laine-vierge ) failed
[REWRITE] stat( /home/www/xyz.com/laine/100-laine-vierge ) failed
[REWRITE] Source URI: '/100-laine-vierge' => Result URI: '/'
[REWRITE] Rule: Match '/' with pattern '^(.*)$', result: 2
[REWRITE] Cond: Match '' with pattern 'mosConfig_[a-zA-Z_]{1,21}(=|\%3D)', result: -1
[REWRITE] Cond: Match '' with pattern 'base64_encode.*\(.*\)', result: -1
[REWRITE] Cond: Match '' with pattern '(\<|%3C).*script.*(\>|%3E)', result: -1
[REWRITE] Cond: Match '' with pattern 'GLOBALS(=|\[|\%[0-9A-Z]{0,2})', result: -1
[REWRITE] Cond: Match '' with pattern '_REQUEST(=|\[|\%[0-9A-Z]{0,2})', result: -1
[REWRITE] Rule: Match '/' with pattern '(.*)', result: 2
[REWRITE] Cond: Match '/' with pattern '^(/component/option,com)', result: -1
[REWRITE] Cond: Match '/' with pattern '(/|\.htm|\.php|\.html|/[^.]*)$', result: 2
[REWRITE] Cond: test '/home/www/xyz.com/laine' with pattern '-f', result: 1
[REWRITE] Cond: test '/home/www/xyz.com/laine' with pattern '-d', result: 0
[REWRITE] Rule: Match '/' with pattern '^(.*)$', result: 2
[REWRITE] Cond: Match '' with pattern 'mosConfig_[a-zA-Z_]{1,21}(=|\%3D)', result: -1
[REWRITE] Cond: Match '' with pattern 'base64_encode.*\(.*\)', result: -1
[REWRITE] Cond: Match '' with pattern '(\<|%3C).*script.*(\>|%3E)', result: -1
[REWRITE] Cond: Match '' with pattern 'GLOBALS(=|\[|\%[0-9A-Z]{0,2})', result: -1
[REWRITE] Cond: Match '' with pattern '_REQUEST(=|\[|\%[0-9A-Z]{0,2})', result: -1

thanks again for looking into this.
 

mistwang

LiteSpeed Staff
#6
The execution of the rewrite looks correct. When result is 1 or 2, means the pattern has been matched.
/100-laine-vierge was rewritten to "/".

Have you configured those rewrite rules at vhost level? It will affect some PHP _SERVER[] variables as we made some change to match Apache's behavior.

If you prefer not using .htaccess, you can create a "/" static context and configure rewrite rules there.
 
Top