(By the way it's quite likely that this line is already on the httpd.conf. You
just have to uncomment it).
</p>
<p>
Add this line to httpd.conf in order to activate mod_rewrite:
</p>
<source>
RewriteEngine On
</source>
<p>
It is highly recommended to use the logging option of mod_rewrite, in
order to check the correctness of the URI rewriting. Just add these lines
to the httpd.conf:
</p>
<source>
RewriteLog "C:/logs/rewrite.log"
RewriteLogLevel 9
</source>
<p>
The first line tells Apache to put the URI rewriting log in the
c:\logs\rewrite.log file (which happens to be on a Windows system, of
course). The second one tells Apache to record everything mod_rewrite
does. If you don't want to log anything, just set RewriteLogLevel to
0.
</p>
<p>
Now, it's time to do the URI rewriting trick.
</p>
<source>
RewriteRule bar/(.*) /cocoon/bar/$1 [PT]
</source>
<p>
This line instructs Apache to redirect everything under "bar" to
"cocoon/bar" and to pass it on for other processing ("[PT]" option),
like mod_alias.
</p>
<p>
Just restart Apache and point your browser to:
</p>
<source>
<your-server>:8080/bar/<something>
</source>
<p>
It should work just fine.
</p>
<note>
The RewriteRule may not work in all cases (notably under Slackware Linux with Apache 1.3),
if so, try replacing it with:
RewriteRule ^/Foo /cocoon/Foo/ [R]
RewriteRule ^/Foo(.*) /cocoon/Foo$1 [R]
</note>
<note>
Another user adds: In my experience, session support is lost when you use mod_rewrite because the cookie path for the Cocoon session is "/cocoon". Because the browser sees the path differently, the session cookie is not granted access, and sessions don't work. I got around this by renaming Cocoon to ROOT, I imagine setting the default docBase would have the same effect.
</note>
</answer>
</faq>
<faq>
<question>How could I have my Cocoon app located in a directory other than
$TOMCAT_HOME/webapps/cocoon/<my-app>?
</question>
<answer>
<note>
This entry was tested under Windows NT 4.0 + Apache 1.3.14 + Tomcat 3.2 + Cocoon
2.0b1.
</note>
<p>Let's suppose the following.</p>
<ol>
<li>
You have an application called "foo" which works perfectly when
located under the %TOMCAT_HOME%\webapps\cocoon\foo directory.
</li>
<li>
You want it to be located under the "c:\foo" directory instead
</li>
</ol>
<p>
This could be accomplished quite easily by twisting the sitemap a little bit. The
idea is to mount the sub-sitemap of the "foo" application in a specific
location of the file system instead of under the default cocoon context.