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

Re: strange behavior of dh_dhelp



On Mon, 27 Sep 1999, Peter S Galbraith wrote:

> > There were some rumors, that Apache would be able to handle both
> > directories as http://localhost/doc/ (use /usr/share/doc/<foo> and
> > if the file/directory isn't available fall back to
> > /usr/doc/<foo>), but I don't know enough about Apache to realize
> > this myself and I didn't see an example how to do this, so it
> > seems to be only a rumor but not reality :-(

> Have you tried the mod_rewrite solution posted late in July?

It seems that I missed this.  But I found it in the archive and it
works really great now.  Maybe others have the same problem, so here's 
the solution again (with /usr/doc as the primary directory and
/usr/share/doc the secondary, which I prefer):

In httpd.conf:

LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so


In srm.conf:

<IfModule mod_rewrite.c>
   RewriteEngine on
   
   # For requested files beginning with /doc/, try looking for the
   # document in /usr/doc.
   RewriteCond  %{REQUEST_FILENAME} ^/doc/
   RewriteCond  /usr%{REQUEST_FILENAME} -f [OR]
   RewriteCond  /usr%{REQUEST_FILENAME} -d [OR]
   RewriteCond  /usr%{REQUEST_FILENAME} -l
   RewriteRule ^(.+) /usr$1 [L]

   # Next, try looking for the document in /usr/share/doc.
   RewriteCond  %{REQUEST_FILENAME} ^/doc/
   RewriteCond  /usr/share%{REQUEST_FILENAME} -f [OR]
   RewriteCond  /usr/share%{REQUEST_FILENAME} -d [OR]
   RewriteCond  /usr/share%{REQUEST_FILENAME} -l
   RewriteRule ^(.+) /usr/share$1 [L]

   # Attempt to deal with directory listings.
   RewriteCond  %{REQUEST_FILENAME} ^/doc/?$
   # Just list /usr/doc for now.
   RewriteRule ^(.+) /usr/doc/ [L]

   # Neither worked.  Just pass through to do whatever we would have
   # done before.
   RewriteRule ^(.+) - [PT]
</IfModule>

<IfModule !mod_rewrite.c>
   # mod_rewrite isn't available, so fallback to a simple Alias.
   Alias /doc/ /usr/doc/
</IfModule>


Maybe this should be added to the defaults of apacheconfig
(/usr/share/doc/apache/examples/*)?

Ciao

        Roland

-- 
 * roland@spinnaker.de * http://www.spinnaker.de/ *
 PGP: 1024/DD08DD6D   2D E7 CC DE D5 8D 78 BE  3C A0 A4 F1 4B 09 CE AF


Reply to: