Note that there are some explanatory texts on larger screens.

plurals
  1. POrewriting "/foo/bar" to "index.html" adds "foo" to all relative urls
    text
    copied!<p>I'm trying to rewrite all incoming urls (that don't link to a physical file on the filesystem) to my index.html (and process the urls with history.js in there further)</p> <h2>my htaccess:</h2> <pre><code>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></pre> <p><code>localhost/www.xy.de/&lt;foo&gt;</code> works perfectly, but </p> <p><code>localhost/www.xy.de/&lt;foo&gt;/&lt;bar&gt;</code> not really. Even in the second example, it gets redirected to the index.html, but something strange happens:</p> <h2>rewrite.log:</h2> <p><a href="http://sprunge.us/GiEM" rel="nofollow">http://sprunge.us/GiEM</a> (same as below for better reading)</p> <pre><code>[...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] add path info postfix: /srv/http/www.xy.de/yxc -&gt; /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 -&gt; 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' =&gt; matched [...][rid#1dfc7e0/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-d' =&gt; matched [...][rid#1dfc7e0/initial] (2) [perdir /srv/http/www.xy.de/] rewrite 'yxc/z' -&gt; 'www.xy.de/index.html' [...][rid#1dfc7e0/initial] (3) [perdir /srv/http/www.xy.de/] add per-dir prefix: www.xy.de/index.html -&gt; /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 -&gt; www.xy.de/index.html [...][rid#1dfc7e0/initial] (4) add subst prefix: www.xy.de/index.html -&gt; /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 -&gt; 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' =&gt; 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 -&gt; /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 -&gt; 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' =&gt; matched [...][rid#1e00800/initial] (4) [perdir /srv/http/www.xy.de/] RewriteCond: input='/srv/http/www.xy.de/yxc' pattern='!-d' =&gt; matched [...][rid#1e00800/initial] (2) [perdir /srv/http/www.xy.de/] rewrite 'yxc/static/main.css' -&gt; 'www.xy.de/index.html' [...][rid#1e00800/initial] (3) [perdir /srv/http/www.xy.de/] add per-dir prefix: www.xy.de/index.html -&gt; /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 -&gt; www.xy.de/index.html [...][rid#1e00800/initial] (4) add subst prefix: www.xy.de/index.html -&gt; /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] </code></pre> <p>The problem lies in this line: </p> <p><code>add path info postfix: /srv/http/www.xy.de/yxc -&gt; /srv/http/www.xy.de/yxc/static/main.css</code> This happens for all the images/scripts/stylesheets (so all relative links) in the html file and of course since there is no file with this prefix, everything gets redirected to index.html and everything is messed up.</p> <p><strong>Why does the webserver add the <code>yxc</code> to the path? And how can i prevent this behaviour?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload