Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to translate Apache2 htaccess rules to lighttpd rewrite rules. My lighttpd version is 1.4.33. Chevereto uses the G\ php microframework.

Apache2 htaccess rule i am trying to convert:

RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule images/.+\.(gif|jpe?g|png|bmp) - [NC,L,R=404]
RewriteRule images/.+\.(gif|jpe?g|png|bmp) content/images/system/404.gif [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpe?g|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
RewriteRule . index.php [L]

My current lighttpd rules:

url.rewrite-if-not-file = ( "^/images/.+\.(gif|jpe?g|png|bmp)$" => "/content/images/system/default/404.gif" )

$HTTP["url"] !~ "\.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpe?g|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$" {
        url.rewrite-if-not-file = ( "(\?.+)+$" => "/index.php$1" )

}

I am getting an HTTP 404 error with these rules. I managed to fix it by using server.error-handler-404 = "/index.php" but by using this rule its loosing the get query.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.