Brauche Hilfe mit lighttpd und modrewrite

xeomueller

Registered User
Hallo SSF Community,

ich suche Jemanden, der sich bei lighttpd etwas zu hause fühlt.

Mein Problem ist folgendes: ich habe mein Blogprojekt von einem alten Debian 5 Server (lighttpd) auf eine neuen Server mit Debian 7 (auch lighttpd) umgezogen.

Läuft auch alles einwandfrei bis auf die URLs von den einzlenen Blogs. Diese produzieren eine 404 Meldung. So dass ich davon ausgehen muss, dass was mit der Syntax nicht stimmt.

http://217.79.179.67/home.php

Alle anderen URLs gehen einwandfrei.

Das ist meien lighttp.conf

#### url handling modules (rewrite, redirect, access)
url.rewrite = ( "^[^include]+/images/(.*)$" => "/images/$1",
"^.+/uploads/(.*)$" => "/uploads/$1",
"^/([^/]+)/friends/page([0-9]+)/([^/]+)[/]?$" => "/friends.php?w=$1&page=$2$3",
"^/([^/]+)/friends/page([0-9]+)[/]?$" => "/friends.php?w=$1&page=$2",
"^/([^/]+)/friends/([^/]+)[/]?$" => "/friends.php?w=$1$2",
"^/([^/]+)/friends/?$" => "/friends.php?w=$1",
"^/([^/]+)/page([0-9]+)/([^/]+)[/]?$" => "/index.php?w=$1&page=$2$3",
"^/([^/]+)/page([0-9]+)[/]?$" => "/index.php?w=$1&page=$2",
"^/profiles/([^/]+)/([^/]+)[/]?$" => "/profile.php?u=$1$2",
"^/profiles/([^/]+)[/]?$" => "/profile.php?u=$1",
"^/profiles/?$" => "/profile.php",
"^/tag/([^/]+)/([^/]+)[/]?$" => "/tags.php?tags=$1$2",
"^/tag/([^/]+)[/]?$" => "/tags.php?tags=$1",
"^/tag/?$" => "/tags.php?tags=$1",
"^/albums/([^/]+)/([^/]+)[/]?$" => "/album.php?u=$1$2",
"^/albums/([^/]+)[/]?" => "/album.php?u=$1$2",
"^/albums/?$" => "/album.php?u=",
"^/([^/]+)/archive/([^/]+)/([^/]+)/([^/]+)[/]?$" => "/archive.php?w=$1&y=$2&m=$3$4",
"^/([^/]+)/archive/([^/]+)?/([^/]+)[/]?$" => "/archive.php?w=$1&y=$2&m=$3",
"^/([^/]+)/archive/([^/]+)[/]?$" => "/archive.php?w=$1$2",
"^/([^/]+)/archive[/]?$" => "/archive.php?w=$1",
"^/([^/]+)/([0-9]+)/([^/]+).html$" => "/entry.php?w=$1&e_id=$2",
"^/([^/]+)/([0-9]+)/([^/]+)/?$" => "/entry.php?w=$1&e_id=$2$3",
"^/([^/]+)/([0-9]+)[/]?$" => "/entry.php?w=$1&e_id=$2",
"^/([^/]+)/([^/]+)/page([0-9]+)/([^/]+)[/]?$" => "/index.php?w=$1&category=$2&page=$3$4",
"^/([^/]+)/([^/]+)/page([0-9]+)[/]?$" => "/index.php?w=$1&category=$2&page=$3" )


Das ist meine rewrite.lua

attr = lighty.stat(lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"])
if (not attr) then
x = string.gsub(lighty.env["request.uri"], "^/[^/]+/?[^/]*/?([^/]*)/?$", "%1")
y = string.gsub(lighty.env["request.uri"], "^/[^/]+/?([^/]*)/?[^/]*/?$", "%1")
z = string.gsub(lighty.env["request.uri"], "^/([^/]+)/?[^/]*/?[^/]*/?$", "%1")
-- schauen ob URL schon rewrited wurde:
if (lighty.env["request.orig-uri"] == lighty.env["request.uri"]) then
lighty.env["physical.rel-path"] = "index.php"
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
lighty.env["uri.query"] = "w=" .. z
lighty.env["uri.path"] = "/index.php"
lighty.env["uri.path-raw"] = "/index.php"
if (string.len(y) > 0) then
print("Kategorie: " .. y)
lighty.env["uri.query"] = lighty.env["uri.query"] .. "&category=" .. y
end
if (string.len(x) > 0) then
print("Subkategorie: " .. x)
lighty.env["uri.query"] = lighty.env["uri.query"] .. x
end
lighty.env["request.uri"] = "/index.php?" .. lighty.env["uri.query"]
end
end

Und das wäre die ursprüngliche .htaccess

RewriteEngine On
Options +Followsymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*/images/(.*)$ /images/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*/uploads/(.*)$ /uploads/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/([^/]+)/?$ /friends.php?w=$1&page=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/?$ /friends.php?w=$1&page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/([^/]+)/?$ /friends.php?w=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/?$ /friends.php?w=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/page([0-9]+)/([^/]+)/?$ /index.php?w=$1&page=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/page([0-9]+)/?$ /index.php?w=$1&page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/([^/]+)/?$ /profile.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/?$ /profile.php?u=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/?$ /profile.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/([^/]+)/([^/]+)/?$ /album.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/([^/]+)/?$ /album.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/?$ /album.php?u= [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)/([^/]+)/([^/]+)/?$ /archive.php?w=$1&y=$2&m=$3$4 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)?/([^/]+)/?$ /archive.php?w=$1&y=$2&m=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)/?$ /archive.php?w=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/?$ /archive.php?w=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/([^/]+).html$ /entry.php?w=$1&e_id=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/([^/]+)/?$ /entry.php?w=$1&e_id=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/?$ /entry.php?w=$1&e_id=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/page([0-9]+)/([^/]+)/?$ /index.php?w=$1&category=$2&page=$3$4 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/page([0-9]+)/?$ /index.php?w=$1&category=$2&page=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /index.php?w=$1&category=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?w=$1&category=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /index.php?w=$1 [L]

Kann wer helfen?

Ich erwarte keine kostenlose Hilfe, sondern werde natürlich den Aufwand bezahlen.
 
Last edited by a moderator:
Top