Am Donnerstag, 12. November 2009 22:34:19 schrieb Reinhold Kainhofer:
> In the .htaccess file in the server's base web directory (i.e. the dir that
> contains web/), simply add:
> 
> ###########################################
> 
> ## Rewrite all non-existing files at toplevel to the /web/ dir, so our
> ## internal structure for rsync doesn't have to be changed.
> RewriteEngine on
> RewriteBase /
> 
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*)$ /web/$1 [QSA,L]
> 
> 
> ###########################################
> 
> Explanation:
> First, turn on the rewriting engine and tell it that it is rewriting at the
> web server root (I'm not sure whether the RewriteBase is needed at all).
> 
> Then we check, if a file (-f) or a dir (-d) with the requested name exists.
>  Or rather, we check that none of them exist (the ! negation) and only in
>  that case, rewrite all requests from /foo/ to use /web/foo/ internally
>  instead.

Oops, sorry, missed one small issue: The rewriting engine is applied to the 
rewritten internal path again. So, if a request for /foo is received, it 
rewrites to /web/foo and applies the rules again (until they no longer apply). 
If /path/to/server/root/web/foo does not exists, the rule applies again,  so 
it's reqritten to /web/web/foo, which will again be rewritten and so on. 
The solution is to check whether the request is already for /web/.* and in 
that case don't apply the rule.

Here's the updated snippet for the .htaccess file:

###########################################

## Rewrite all non-existing files at toplevel to the /web/ dir, so our 
## internal structure for rsync doesn't have to be changed.
RewriteEngine on
RewriteBase /

# Don't rewrite already rewritten pathes!
RewriteCond %{REQUEST_URI} !^/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /web/$1 [QSA,L]

###########################################

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to