문제

In Lighttpd, how would I express:

"if folder or file exists then navigate to it, else do rewrite rules below"

In Apache this worked well:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

Many thanks,

Mike

도움이 되었습니까?

해결책

There isn't a mechanism like that in lighttpd. You can only check if a file doesn't exist. That means whatever rules you have after:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

Will need to go into a block like this:

url.rewrite-if-not-file = (


)

edit: added equals sign

Because if the mod_rewrite rules that you have in your question doesn't get executed (which stops rewriting if the request is for a file/directory that exists), that means the request is for a file/directory that doesn't exist.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top