PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   PHP für Fortgeschrittene und Experten (http://www.selfphp.de/forum/forumdisplay.php?f=13)
-   -   Apache, mod_rewrite oder Skript macht dumm (http://www.selfphp.de/forum/showthread.php?t=7482)

c4 17.04.2004 10:30:18

Apache, mod_rewrite oder Skript macht dumm
 
Moin,

fiel mir doch vor ein paar Tagen auf, dass ein Link auf einmal nicht mehr funzt. Ich weiß nur nicht warum.

Der Link: http://dbCF.de/t-colorfader/
Ergebnis: 404er, Logfile: "File does not exist: /is/htdocs/xxxxx/www.dbcf.de/t-colorfader/" Aber genau dagegen gibt es ja mod_rewrite, was überall sonst auf der Seite funktioniert.

.htaccess
Code:

RewriteCond %{SERVER_NAME} (.*)dbcf.de(.*)
RewriteRule !(flashhasser|dbcf)|.(doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$ /is/htdocs/xxxxx/www.dbcf.de/mod_rewrite.php [L]

mod_rewrite.php
PHP-Code:

<?php
if (strstr(strtolower($_SERVER['SERVER_NAME']), 'dbcf.de')) {
    
$server='online';
    
$max=3;
}
else {
    
$server='local';
    
$max=4;
}


$url=explode('/'strip_tags($_SERVER['REQUEST_URI']));
if (
count($url)>$max) {
    if (
$server=='online') {
        
header('Location: [url]http://dbCF.de/[/url]');
    }
    else {
        
header('Location: [url]http://meine/dbcf/[/url]');
    }
}
else {
    
$i=count($url);
    while (
$i>=0) {
        if (isset(
$url[$i]) && (substr($url[$i], 02)=='t_' || substr($url[$i], 02)=='t-')) {
            
$t=substr($url[$i], 2strlen($url[$i]));
            
$subdir=1;
            break;
        }
        
$i--;
    }

    if (
$server=='online') {
        @include(
'http://dbCF.de/index.php?subdir='.$subdir.'&topic='.$t.'&ip='.$_SERVER['REMOTE_ADDR']);
    }
    else {
        @include(
'http://meine/dbcf/index.php?subdir='.$subdir.'&topic='.$t.'&ip='.$_SERVER['REMOTE_ADDR']);
    }
}

exit;
?>

Wie ihr seht, steht in beiden nix bösartiges drin.

Der Aufruf über http://dbCF.de/index.php?topic=colorfader funktioniert weiterhin 1a. Also liegt es nicht an der Datei, die topic auswertet.

Kann mir mal einer sagen, was an http://dbCF.de/t-colorfader/ so anders ist, als z.B. http://dbCF.de/t-mein-bike/ oder allen anderen Links auf http://dbCF.de/t-hits-per-page/ ??


Mit Dank und fG
Carsten

c4 21.07.2004 08:45:31

Hochpushen ist nicht lieb, ich weiß.

Das Problem gibt es aber noch immer. Inzwischen sogar mit einer weiteren, neu hinzugefügten Seite: colorfader-quelltext Die colorfader_source.php entstand aus einer Kopie der colorfader.php und der Eintrag in meiner $topic-Auswertungsdatei aus einer Kopie vom ColorFader. Die Auswertung sieht so aus:
PHP-Code:

else if ($topic=='colorfader') { $inc='skripte/colorfader.php'$tpc=3$title='ColorFader mit PHP'; }
else if (
$topic=='colorfader-quelltext') { $inc='skripte/colorfader_source.php'$tpc=3$title='Quelltext des PHP-ColorFaders'; } 

Das $inc wird dann einfach irgendwo includet.

Hat inzwischen jemand eine Idee?

feuervogel 21.07.2004 10:06:13

hast du mal in die server logs geschaut, was das modrewrite draus macht?

kannst du nicht 404 fehlerseiten auch einfach per .htaccess festlegen, ich versteh ich nicht so ganz den umstand mit mod-rewrite.php...?

c4 21.07.2004 10:17:01

Eingabe: http://localhost/dbcf/t-colorfader/
Error: [Wed Jul 21 10:10:39 2004] [error] [client 127.0.0.1] File does not exist: F:/php/dbCF/t-colorfader
Umleitung zur 404er-Seite

In der access.log steht dann das:
127.0.0.1 - - [21/Jul/2004:10:12:57 +0200] "GET /dbcf/t-colorfader// HTTP/1.1" 302 341

Eingabe: http://localhost/dbcf/t-asd/
Error: keiner
Umleitung zur Startseite, da asd ungültiges topic ist.
--> Das ist gut!

404er habe ich natürlich in der .htaccess definiert. Daran scheitert es nicht.

sniechzial 27.07.2004 00:24:26

mod_Rewrite Log
 
Hi,

mir hat bei Problemen mit Rewrite immer das Log des Moduls geholfen. Das kannst du in der Apache config mit

Code:

RewriteLog "/[logdir]/rewrite.log"
RewriteLogLevel [0...9]

aktivieren.
Kannst ja dann, wenn du nicht schlau wirst das Log hier posten.

Weitere Infos...

MfG,
simon

c4 27.07.2004 08:53:56

Gute Idee mit dem RewriteLog. Hilft mir aber nicht weiter.

Ich habe es mal bei 2 Seiten laufen lassen, bei einer, die funktioniert (Besucherzähler) und beim ColorFader. Das Ergebnis sieht so aus (IP und so wurde aus Platzgründen entfernt):
Code:

[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-besucherzaehler -> F:/php/dbCF/t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-besucherzaehler/ -> t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 't-besucherzaehler/'
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-besucherzaehler -> F:/php/dbCF/t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-besucherzaehler/ -> t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 't-besucherzaehler/'
[rid#ed5d60/initial] (4) RewriteCond: input='localhost' pattern='(.*)dbcf.de(.*)' => not-matched
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-besucherzaehler -> F:/php/dbCF/t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-besucherzaehler/ -> t-besucherzaehler/
[rid#ed5d60/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 't-besucherzaehler/'
[rid#ed5d60/initial] (4) RewriteCond: input='localhost' pattern='(.*)localhost(.*)' => matched
[rid#ed5d60/initial] (2) [per-dir F:/php/dbCF/] rewrite t-besucherzaehler/ -> /dbcf/mod_rewrite.php
[rid#ed5d60/initial] (1) [per-dir F:/php/dbCF/] internal redirect with /dbcf/mod_rewrite.php [INTERNAL REDIRECT]
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/mod_rewrite.php -> mod_rewrite.php
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'mod_rewrite.php'
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/mod_rewrite.php -> mod_rewrite.php
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'mod_rewrite.php'
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/mod_rewrite.php -> mod_rewrite.php
[rid#edb4c0/initial/redir#1] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'mod_rewrite.php'
[rid#edb4c0/initial/redir#1] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/mod_rewrite.php
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/index.php -> index.php
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'index.php'
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/index.php -> index.php
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'index.php'
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/index.php -> index.php
[rid#529cd10/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'index.php'
[rid#529cd10/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/index.php
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_normal.css -> css_normal.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'css_normal.css'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_normal.css -> css_normal.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_normal.css'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_normal.css -> css_normal.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_normal.css'
[rid#ed9fc8/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/css_normal.css
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_tty.css -> css_tty.css
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'css_tty.css'
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_tty.css -> css_tty.css
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_tty.css'
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_tty.css -> css_tty.css
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_tty.css'
[rid#ed7d68/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/css_tty.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_print.css -> css_print.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'css_print.css'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_print.css -> css_print.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_print.css'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/css_print.css -> css_print.css
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'css_print.css'
[rid#ed9fc8/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/css_print.css
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/bilder/blind.gif -> bilder/blind.gif
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 'bilder/blind.gif'
[rid#ed7d68/initial] (4) RewriteCond: input='localhost' pattern='(.*)dbcf.de(.*)' => not-matched
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/bilder/blind.gif -> bilder/blind.gif
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'bilder/blind.gif'
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/bilder/blind.gif -> bilder/blind.gif
[rid#ed7d68/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 'bilder/blind.gif'
[rid#ed7d68/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/bilder/blind.gif

[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-colorfader -> F:/php/dbCF/t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-colorfader/ -> t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '.(gif|jpg|png)$' to uri 't-colorfader/'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-colorfader -> F:/php/dbCF/t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-colorfader/ -> t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 't-colorfader/'
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] add path info postfix: F:/php/dbCF/t-colorfader -> F:/php/dbCF/t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] strip per-dir prefix: F:/php/dbCF/t-colorfader/ -> t-colorfader/
[rid#ed9fc8/initial] (3) [per-dir F:/php/dbCF/] applying pattern '(localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$' to uri 't-colorfader/'
[rid#ed9fc8/initial] (1) [per-dir F:/php/dbCF/] pass through F:/php/dbCF/t-colorfader

Die fett gedruckte Zeile ist die erste signifikant abweichende.

Wird daraus jemand schlau?

c4 27.07.2004 08:58:41

tsts... Beitrag zu lang...


Meine .htaccess sieht übrigens so aus:
Code:

RewriteEngine on

RewriteCond %{SERVER_NAME} (.*)dbcf.de(.*) [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !(.*)dbcf.de(.*) [NC]
RewriteRule .(gif|jpg|png)$ /is/htdocs/xxxxx/www.dbcf.de/bilder/pfui.gif [L]

RewriteCond %{SERVER_NAME} (.*)dbcf.de(.*)
RewriteRule !(flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$ /is/htdocs/xxxxx/www.dbcf.de/mod_rewrite.php [L]
RewriteCond %{SERVER_NAME} (.*)localhost(.*)
RewriteRule !(meine|localhost|flashhasser|dbcf|lo|get)|.(pdf|doc|exe|rar|gif|jpg|png|css|zip|js|htm|log|ico|txt|php|sql)$ /dbcf/mod_rewrite.php [L]

ErrorDocument 400 http://dbCF.de/t-fehler/
ErrorDocument 402 http://dbCF.de/t-fehler/
ErrorDocument 403 http://dbCF.de/t-fehler/
ErrorDocument 404 http://dbCF.de/t-404/
ErrorDocument 405 http://dbCF.de/t-fehler/
ErrorDocument 406 http://dbCF.de/t-fehler/
ErrorDocument 407 http://dbCF.de/t-fehler/
ErrorDocument 408 http://dbCF.de/t-fehler/
ErrorDocument 409 http://dbCF.de/t-fehler/
ErrorDocument 410 http://dbCF.de/t-fehler/
ErrorDocument 411 http://dbCF.de/t-fehler/
ErrorDocument 412 http://dbCF.de/t-fehler/
ErrorDocument 413 http://dbCF.de/t-fehler/
ErrorDocument 414 http://dbCF.de/t-fehler/
ErrorDocument 415 http://dbCF.de/t-fehler/
ErrorDocument 416 http://dbCF.de/t-fehler/
ErrorDocument 417 http://dbCF.de/t-fehler/
ErrorDocument 500 http://dbCF.de/t-fehler/
ErrorDocument 501 http://dbCF.de/t-fehler/
ErrorDocument 502 http://dbCF.de/t-fehler/
ErrorDocument 503 http://dbCF.de/t-fehler/
ErrorDocument 504 http://dbCF.de/t-fehler/
ErrorDocument 505 http://dbCF.de/t-fehler/


c4 02.08.2004 08:37:57

Ich hab's !!
 
Freitag Abend fiel es mir wie Augen von den Schuppen! Die Lösung ist so erschreckend einfach, wie auch schon fast peinlich...

Ich habe für einen Freund einen LAN-Organiser programmiert. Feines Ding, funktioniert auch 1a.
Auf meinem Server findet man es unter dbCF.de/lo/ Damit für dieses Verzeichnis mod_rewrite nicht angewandt wird, steht in der .htaccess folgendes: RewriteRule !(meine|localhost|flashhasser|dbcf|lo|get)|... Das Problem ist das lo! Er überspringt alles, was im URI 'lo' enthält. Also auch ColorFader!
Macht man nun in der .htaccess vor das lo einen Slash (/lo), dann ist das kein String, der in ColorFader vorkommt und alles klappt wunderbar. :)

Ich danke allen, die sich an dem Problem versucht haben!


Alle Zeitangaben in WEZ +2. Es ist jetzt 12:07:08 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.