Below is my .htaccess file from apache. I'm getting a 404 not found error on my subdirectories, and I am certain it has to do with my rewrite.
Options -Indexes
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* file.php [L,QSA]
</IfModule>
Here is my lighttpd.conf rewrite
$HTTP["host"] =~ "www.example.com" {
url.rewrite = ( "^(.*)$" => "$1.php" )
}
server.follow-symlink = "enable"
I know the "$1.php" isn't the right answer. It sort-of works, but I wouldn't consider it functional. It's sole purpose here is to help put together what I'm trying to do.
For
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
see https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRedirect
$HTTP["host"] == "example.com" {
url.redirect = ( "^(.*)$" => "http://www.example.com$1" )
}
For
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* file.php [L,QSA]
https://redmine.lighttpd.net/boards/2/topics/6459
For !-f and !-d See url.rewrite-if-not-file
in https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRewrite
For QSA, match the query string using a lighttpd condition block and then substitute with %1, e.g.
$HTTP["querystring"] =~ "(.*)" {
url.rewrite-if-not-file = ( "..." => "...&%1" )
} else {
url.rewrite-if-not-file = ( "..." => "..." )
}