Rewrite subrequests

#1
Hello,

I'm new here using litespeed. I installed and running the litespeed in a cPanel server but I'm already have some problems in some sites with -F rewrite rules:

Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond assets/$1 -F
        RewriteRule (.+) assets/$1 [L]

        RewriteCond $0 !^(index\.php|assets/|google77b2c5c639aadf67.html|pc/valida.txt)
        RewriteRule (.*) index.php?/$1 [QSA]
</IfModule>
This ruleset simply don't work (the litespeed don't find the assets). Searching about it I found here that Litespeed's rewrite engine don't process subrequest like this "-F" used in this .htaccess.

Someone know how could I workaround it?

Obs.: This code isn't mine is from one of my costumers. So i'm very limited in how could I can modify it.
 

NiteWave

Administrator
#2
http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond
Code:
-f
Is regular file.
Treats the TestString as a pathname and tests whether or not it exists, and is a regular file.

-F
Is existing file, via subrequest.
Checks whether or not TestString is a valid file, accessible via all the server's currently-configured access controls for that path. This uses an internal subrequest to do the check, so use it with care - it can impact your server's performance!
how about use -f instead of -F ?
 
#3
I already tried but don't work due recursively to a non-documentroot structure (assets/$1). In fact the currently -F already actually works like -f in LS so it's unable to search inside assets directory tree if the file exists. That's why I'm asking if there's another way to search inside a subdir tree that aren't put in URL what's the -F currently do.
 

Pong

Administrator
Staff member
#4
Please try:
Code:
        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}/assets/$1 -F
        RewriteRule (.+) assets/$1 [L]
 
Top