Litespeed .htaccess performance question

#1
Is there an advantage of specifying my rewrite rules direclty in the vhost config of litespeed rather than in a .htaccess file?

Perhaps it's quicker, or gets cached etc?

Thanks
 
#3
That's what I thought.

I'm trying to run these rewrites for my drupal 5.7 site and after turning on logging I think I've found the problem.

The rewrite:
Code:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
The error is:
Code:
[REWRITE] Source URI: '/providers' => Result URI: 'index.php?q=/providers'
It would apear that it's grabbing the entire string of '/providers' with the forward slash, when it should only be 'providers'.

This is the exact code which works when placed in the .htacess file:
Code:
<Directory /www/domain.com/public>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
I've tried it with and without the <directory> part,.. with and without the RewriteBase on.

I get this error in firefox:
Code:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

Any help would be greatly appreciated.

Thanks
 
#4
Not sure but the regex you are using will always take the entire strings its passed from begining( ^ ) to end( $ ). Since not using an htaccess seems to be adding a / try maybe this regex which will only trap anything AFTER the / and insert it in variable $1.


Code:
RewriteRule ^/(.*)$ index.php?q=$1 [L,QSA]

Timothy J. Biggs
--
Senior Vice President / CIO

BLUE GRAVITY COMMUNICATIONS, INC.
3495 Haddonfield Rd. Suite 6
Pennsauken, NJ 08109
Toll Free: 1-877-8 HOSTING
Tel: (856)662-9100, Fax: (856) 662-9101
Email: tim@bluegravity.com
http://www.bluegravity.com
 

mistwang

LiteSpeed Staff
#5
The URI used for a rewrite rule in .htaccess is different from the rewrite rule configured at vhost level. Basically, the rewrite base will be removed from the URI before matches the URI with a rewrite rules in .htaccess.
You need to change the rewrite rule according like what Timothy suggested when you move a rewrite rule form .htaccess to vhost level.
 
Top