Variablen in Apache-Konfiguration?
Variablen in Apache-Konfiguration?
Hallo Zusammen
Ich möchte folgendes realisieren:
Es gibt die URL
http://mct4test.sbb.ch/ worin sich statische Seiten befinden und
http://mct4test.sbb.ch/mct worin sich ein CM befindet.
Jetzt sollen alle fehlerhafte (404) Anfragen nach /mct geleitet werden, aber es soll auch der verlangte Filename angehängt werden.
ErrorDocument 404 /mct/
Das leitet einfach alle 404 ins /mct und dort nimmt es logischerweise das Index-File.
Aber es soll folgendermassen sein:
wenn jemand http://mct4test.sbb.ch/gibtsnicht.htm eingibt, und es gibtsnicht.htm wirklich nicht gibt, soll er nach http://mct4test.sbb.ch/mct/gibtsnicht.htm geleitet werden.
Ist das irgendwie realisierbar? Kann man im Apache auch variablen (z.B. für den REFERER) verweden?
Besten Dank für Hints
gruss epox
Ich möchte folgendes realisieren:
Es gibt die URL
http://mct4test.sbb.ch/ worin sich statische Seiten befinden und
http://mct4test.sbb.ch/mct worin sich ein CM befindet.
Jetzt sollen alle fehlerhafte (404) Anfragen nach /mct geleitet werden, aber es soll auch der verlangte Filename angehängt werden.
ErrorDocument 404 /mct/
Das leitet einfach alle 404 ins /mct und dort nimmt es logischerweise das Index-File.
Aber es soll folgendermassen sein:
wenn jemand http://mct4test.sbb.ch/gibtsnicht.htm eingibt, und es gibtsnicht.htm wirklich nicht gibt, soll er nach http://mct4test.sbb.ch/mct/gibtsnicht.htm geleitet werden.
Ist das irgendwie realisierbar? Kann man im Apache auch variablen (z.B. für den REFERER) verweden?
Besten Dank für Hints
gruss epox
Re: Variablen in Apache-Konfiguration?
Ungetestet:
Code: Select all
RewriteBase /
RewriteRule ^(.*)$ $1 [C,E=FileExists:yes]
RewriteCond /mct/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /mct/$1 [S=1]
RewriteCond %{ENV:FileExists} ^yes$
RewriteRule ^(.*)$ $1
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Variablen in Apache-Konfiguration?
Hallo Joe User
Besten Dank für deine Antwort, ich werde das gleich mal testen, muss aber erst verstehen, was das ganze tut.
Gebe dann Bescheid.
Gruss
Besten Dank für deine Antwort, ich werde das gleich mal testen, muss aber erst verstehen, was das ganze tut.
Gebe dann Bescheid.
Gruss
Re: Variablen in Apache-Konfiguration?
Soderle, hab Direktive für Direktive anaylsiert und bin zum Schluss gekommen, dass es eigentlich funktionieren sollte...
Der Virtual-Host sieht nun folgendermassen aus:
Jegliche Requests auf diesen VirtualHost enden aber mit einem 400er (Bad Request).
Das LogLevel hab ich wegen dem hochgeschraubt, aber ich erhalte keine einzige Message, die helfen könnte.
Ich bin im Moment echt hilflos und weiss gar nicht wonach ich fragen kann, drum:
Sieht jemand gerade einen Bock in der Glaskugel? :roll:
Auf eine Lösung freut sich
epox
Der Virtual-Host sieht nun folgendermassen aus:
Code: Select all
<VirtualHost *>
ServerName mct4test.sbb.ch
LogLevel debug
CustomLog "|/usr/bin/rotatelogs /var/logs/apache/mct/mct_access.log 86400" combined
ErrorLog /var/logs/apache/mct/mct_error.log
# --- Konfigurationen für Statische Startseite www.sbb.ch
DocumentRoot /var/www/https-www80/docs
#ErrorDocument 404 http://mct4test.sbb.ch/mct
#ErrorDocument 403 http://mct4test.sbb.ch/mct
<Directory "/var/www/https-www80/docs">
Options FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
Allow from all
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
RewriteBase /
RewriteRule ^(.*)$ $1 [C,E=FileExists:yes]
RewriteCond /mct/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /mct/$1 [S=1]
RewriteCond %{ENV:FileExists} ^yes$
RewriteRule ^(.*)$ $1
</Directory>
#------------------------------------------------------------------
</VirtualHost>
Das LogLevel hab ich wegen dem hochgeschraubt, aber ich erhalte keine einzige Message, die helfen könnte.
Ich bin im Moment echt hilflos und weiss gar nicht wonach ich fragen kann, drum:
Sieht jemand gerade einen Bock in der Glaskugel? :roll:
Auf eine Lösung freut sich
epox
Re: Variablen in Apache-Konfiguration?
Versuch's mal so:
Code: Select all
<IfModule mod_rewrite.c>
RewriteLog /var/log/apache2/rewrite_log
RewriteLogLevel 2
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ $1 [C,E=FileExists:yes]
RewriteCond /mct/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /mct/$1 [S=1]
RewriteCond %{ENV:FileExists} ^yes$
RewriteRule ^(.*)$ $1
</IfModule>
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Variablen in Apache-Konfiguration?
Ah voila so lässt sich besser debuggen:
GET auf http://mct4test.sbb.ch :
GET auf http://mct4test.sbb.ch :
GET auf http://mct4test.sbb.ch :10.104.181.24 - - [09/Aug/2004:15:54:59 +0200] [mct4test.sbb.ch/sid#536df0][rid#43820a8/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite ->
10.104.181.24 - - [09/Aug/2004:15:54:59 +0200] [mct4test.sbb.ch/sid#536df0][rid#43820a8/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs// -> /var/www/https-www80/docs//
GET auf http://mct4test.sbb.ch/index_krisehome/ ... ubpage.htm (existiert im /mct Directory):10.104.181.24 - - [09/Aug/2004:15:56:00 +0200] [mct4test.sbb.ch/sid#536df0][rid#43820a8/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite mct -> mct
10.104.181.24 - - [09/Aug/2004:15:56:00 +0200] [mct4test.sbb.ch/sid#536df0][rid#43820a8/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs/mct -> /var/www/https-www80/docs/mct
10.104.181.24 - - [09/Aug/2004:15:56:59 +0200] [mct4test.sbb.ch/sid#536df0][rid#451f6d0/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite index_krisehome/index_krisissubpage.htm -> index_krisehome/index_krisissubpage.htm
10.104.181.24 - - [09/Aug/2004:15:56:59 +0200] [mct4test.sbb.ch/sid#536df0][rid#451f6d0/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs/index_krisehome/index_krisissubpage.htm/index_krisissubpage.htm -> /var/www/https-www80/docs/index_krisehome/index_krisissubpage.htm/index_krisissubpage.htm
Re: Variablen in Apache-Konfiguration?
Hmm, bringt Folgendes den gleichen Output?
Code: Select all
<IfModule mod_rewrite.c>
RewriteLog /var/log/apache2/rewrite_log
RewriteLogLevel 2
RewriteEngine on
RewriteBase /
RewriteRule .* $1 [C,E=FileExists:yes]
RewriteCond /mct/%{REQUEST_FILENAME} -f
RewriteRule .* /mct/$1 [S=1]
RewriteCond %{ENV:FileExists} ^yes$
RewriteRule .* $1
</IfModule>
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Variablen in Apache-Konfiguration?
Nicht ganz:
10.104.181.24 - - [10/Aug/2004:08:32:26 +0200] "GET / HTTP/1.1" 400 299 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8"
10.104.181.24 - - [10/Aug/2004:08:32:42 +0200] "GET /mct HTTP/1.1" 400 299 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8"
10.104.181.24 - - [10/Aug/2004:08:33:00 +0200] "GET /index_krisehome/index_krisissubpage.htm HTTP/1.1" 400 299 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8"
10.104.181.24 - - [10/Aug/2004:08:32:26 +0200] "GET / HTTP/1.1" 400 299 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8"
Code: Select all
10.104.181.24 - - [10/Aug/2004:08:32:26 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite ->
10.104.181.24 - - [10/Aug/2004:08:32:26 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs// ->
Code: Select all
10.104.181.24 - - [10/Aug/2004:08:32:42 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite mct ->
10.104.181.24 - - [10/Aug/2004:08:32:42 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs/ ->
Code: Select all
10.104.181.24 - - [10/Aug/2004:08:33:00 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite index_krisehome/index_krisissubpage.htm ->
10.104.181.24 - - [10/Aug/2004:08:33:00 +0200] [mct4test.sbb.ch/sid#536df0][rid#5d8d60/initial] (2) [per-dir /var/www/https-www80/docs/] rewrite /var/www/https-www80/docs//index_krisissubpage.htm ->
