lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: anybody know apache? (dir structure of docs)


From: Reinhold Kainhofer
Subject: Re: anybody know apache? (dir structure of docs)
Date: Thu, 12 Nov 2009 23:06:54 +0100
User-agent: KMail/1.12.3 (Linux/2.6.31-14-generic; KDE/4.3.3; i686; ; )

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, address@hidden, 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]