Ich versuche gerade alle urls (die nicht auf eine vorhandene Datei im Dateisystem zeigen) auf meine index.html weiterzuleiten (um diese Pfade dort per javascript weiter zu verarbeiten).
Dabei sieht meine htaccess folgendermaßen aus:
- Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
# Rewrite everything that isn't a real file to index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ www.xy.de/index.html
- Code: Select all
localhost/www.xy.de/<foo>
- Code: Select all
localhost/www.xy.de/<foo>/<bar>
Hier ein Auszug aus dem rewrite.log (selber Inhalt wie unten nur angenehmer zu lesen: http://sprunge.us/GiEM)
- Code: Select all
[...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] add path info postfix: /srv/http/www.xy.de/yxc -> /srv/http/www.xy.de/yxc/z
[...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] strip per-dir prefix: /srv/http/www.xy.de/yxc/z -> yxc/z
[...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] applying pattern '^(.+)$' to uri 'yxc/z'
[...][rid#1dfc7e0/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-f' => matched
[...][rid#1dfc7e0/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-d' => matched
[...][rid#1dfc7e0/initial] (2) [perdir /srv/http/www.xy.de/] rewrite 'yxc/z' -> 'www.xy.de/index.html'
[...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] add per-dir prefix: www.xy.de/index.html -> /srv/http/www.xy.de/www.xy.de/index.html
[...][rid#1dfc7e0/initial] (2) [perdir /srv/http/www.xy.de/] trying to replace prefix /srv/http/www.xy.de/ with /
[...][rid#1dfc7e0/initial] (5) strip matching prefix: /srv/http/www.xy.de/www.xy.de/index.html -> www.xy.de/index.html
[...][rid#1dfc7e0/initial] (4) add subst prefix: www.xy.de/index.html -> /www.xy.de/index.html
[...][rid#1dfc7e0/initial] (1) [perdir /srv/http/www.xy.de/] internal redirect with /www.xy.de/index.html [INTERNAL REDIRECT]
[...][rid#1e08850/initial/redir#1] (3) [perdir /srv/http/www.xy.de/] strip per-dir prefix: /srv/http/www.xy.de/index.html -> index.html
[...][rid#1e08850/initial/redir#1] (3) [perdir /srv/http/www.xy.de/] applying pattern '^(.+)$' to uri 'index.html'
[...][rid#1e08850/initial/redir#1] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/index.html' pattern='!-f' => not-matched
[...][rid#1e08850/initial/redir#1] (1) [perdir /srv/http/www.xy.de/] pass through /srv/http/www.xy.de/index.html
[...][rid#1e00800/initial] (3) [perdir /srv/http/www.xy.de/] add path info postfix: /srv/http/www.xy.de/yxc -> /srv/http/www.xy.de/yxc/static/main.css
[...][rid#1e00800/initial] (3) [perdir /srv/http/www.xy.de/] strip per-dir prefix: /srv/http/www.xy.de/yxc/static/main.css -> yxc/static/main.css
[...][rid#1e00800/initial] (3) [perdir /srv/http/www.xy.de/] applying pattern '^(.+)$' to uri 'yxc/static/main.css'
[...][rid#1e00800/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-f' => matched
[...][rid#1e00800/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-d' => matched
[...][rid#1e00800/initial] (2) [perdir /srv/http/www.xy.de/] rewrite 'yxc/static/main.css' -> 'www.xy.de/index.html'
[...][rid#1e00800/initial] (3) [perdir /srv/http/www.xy.de/] add per-dir prefix: www.xy.de/index.html -> /srv/http/www.xy.de/www.xy.de/index.html
[...][rid#1e00800/initial] (2) [perdir /srv/http/www.xy.de/] trying to replace prefix /srv/http/www.xy.de/ with /
[...][rid#1e00800/initial] (5) strip matching prefix: /srv/http/www.xy.de/www.xy.de/index.html -> www.xy.de/index.html
[...][rid#1e00800/initial] (4) add subst prefix: www.xy.de/index.html -> /www.xy.de/index.html
[...][rid#1e00800/initial] (1) [perdir /srv/http/www.xy.de/] internal redirect with /www.xy.de/index.html [INTERNAL REDIRECT]
Wie zu sehen ist, wir alles relativen Link noch das <foo> aus der anfrage vorrangestellt.
Das Problem ist diese zeile::
- Code: Select all
add path info postfix: /srv/http/www.xy.de/yxc -> /srv/http/www.xy.de/yxc/static/main.css
Warum fügt der Webserver "yxc" zum Pfad hinzu und wie kann ich ihn davon abhalten?
Oder sollte ich einen ganz anderen Weg einschlagen? wie würdet ihr das machen
Gruß