htaccess parsing

#1
Hi,

i have a bit of an issue with .htaccess using litespeed.

for example:

RewriteRule ^examples/(.*)$ example.html?id=$1 [QSA,L]
RewriteRule ^examples$ example.html [QSA,L]

RewriteRule ^([a-z0-9\-\/]+)(\.p([0-9]+))?\.(htm|html)$ example.php?url=$1&p=$3 [QSA,L]

would not work on litespeed but work fine on apache.

the thing about this 2 query is the first one change the url in question to a "example.html?id=something" for the second one to turn it into "example.php?url=examples&p=".

is this function supported in litespeed somewhere or somehow?

as it is required to, even if it's slightly inefficient.

Best Regards
 
Last edited:

webizen

Well-Known Member
#2
you can turn on Rewrite logging (admin console -> vhost -> rewrite) and set log level to 9 (highest) to see where is wrong.

my test on these rewriterules are good.
2011-05-13 19:26:26.446 [INFO] [xxx.xxx.xxx.xxx:49299-0#Example] [REWRITE] Rule: Match 'examples/abc' with pattern '^examples/(.*)$', result: 2
2011-05-13 19:26:26.446 [INFO] [xxx.xxx.xxx.xxx:49299-0#Example] [REWRITE] Source URI: 'examples/abc' => Result URI: 'example.html?id=abc'
2011-05-13 19:26:26.446 [INFO] [xxx.xxx.xxx.xxx:49299-0#Example] [REWRITE] append query string 'id=abc'
2011-05-13 19:26:26.446 [INFO] [xxx.xxx.xxx.xxx:49299-0#Example] [REWRITE] Last Rule, stop!
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] Rule: Match 'examples.html' with pattern '^examples/(.*)$', result: -1
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] Rule: Match 'examples.html' with pattern '^examples$', result: -1
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] Rule: Match 'examples.html' with pattern '^([a-z0-9\-\/]+)(\.p([0-9]+))?\.(htm|html)$', result: 5
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] Source URI: 'examples.html' => Result URI: 'example.php?url=examples&p='
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] append query string 'url=examples&p='
2011-05-13 19:24:19.314 [INFO] [xxx.xxx.xxx.xxx:49275-0#Example] [REWRITE] Last Rule, stop!
 
Last edited:
#3
Hi,

it seem a htaccess of 100 line or so long take up to 4 second to prase..... even on litespeed....

we removed all but 10 important line, and it load on avg 4 seconds faster...

we added [QSA,L,E=cache-control:max-age=65535], not much inprovement.

we saw a way to cache it in litespeed itself, but could not find an option anywhere?

Any help on this will be very grateful!

Also we are not using a virtual host for the site, as it's not a shared environment?

Best Regards
 
Last edited:
#7
Hi,

any idea why does this not work?

RewriteRule ^example/?(.*)/?(.*)/?(.*)$ example.php?id=$1&ud=$2&ed=$3 [QSA,L,E=cache-control:max-age=65535]

Best Reagrds
 

webizen

Well-Known Member
#10
everything is covered by the first "(.*)". this is the case in both lsws and apache.

try
RewriteRule ^example/?([^/]*)/?([^/]*)/?([^/]*)$ example.php?id=$1&ud=$2&ed=$3 [QSA,L,E=cache-control:max-age=65535]
 
Last edited:

webizen

Well-Known Member
#12
you can delete everything under cache storage path (defined in admin console->configuration->server->cache) if you want the result not being cached OR remove 'E=cache-control:max-age=65535' from rewrite rule.
 
Top