Project

General

Profile

[UserError] index-file.names not working with mod rewrite

Added by john almost 8 years ago

Version 1.4

I have this in config

@index-file.names = ( "index.html", "index.php" )

url.rewrite-if-not-file = (
"/(.*)$" => "index.php?_url=/$1"
)@

case 1
I have now index.php and index.html and it shows index.php by default as index.html has 1st priority

case 2
when only index.html exists, in this case it shows "404 - Not Found", I'm expecting to display the contents from index.html


Replies (1)

RE: index-file.names not working with mod rewrite - Added by gstrauss almost 8 years ago

This does not work how you imagine it to work.

If nobody else has handled the request, mod_indexfile checks for index-file.names IFF the URL ends in '/' and the target directory exists. However, mod_indexfile runs after url.rewrite-if-not-file has run, so if you rewrite the URL to be something other than a directory, mod_indexfile will ignore the request.

Perhaps you want to try rebuilding lighttpd with the current version of master (to eventually be 1.4.40), where mod_rewrite sets REDIRECT_URI to the original URI, so you can get rid of the index-file.names directive and can have url.rewrite-if-not-file use a full /path/to/a/single/index.php, and still know the origin of the request.

    (1-1/1)