Help with apache mod_rewrite

Joshua Zeidner jjzeidner at gmail.com
Thu Aug 21 12:52:32 MST 2008


  If he's trying to intercept Tomcat requests that may get a bit tricky.  It
depends on what phase in the 'request cycle' Tomcat is hooked into.


http://stein.cshl.org/~lstein/talks/perl_conference/apache_api/lifecycle.html

  -jmz

On Thu, Aug 21, 2008 at 7:20 AM, Alex Dean <alex at crackpot.org> wrote:

> Bryan : None of the example redirects you posted really require regular
> expressions.  As far as I can see you want a simple mapping of /dir1/dir2 to
> /other_dir.  Of course I don't know the details, but it seems like you're
> making this more complicated than it needs to be.  Why won't a simple
> Redirect solve your problem?  If it really won't, I'm interested in the
> reasons.
>
> alex
>
> Joshua Zeidner wrote:
>
>>
>>  Im not sure about mod_proxy, but if you are using httpd2 you can write a
>> small mod_perl TransHandler to do the job:
>>    http://ziya.suzen.net/2007/09/url-rewriting-with-modperl.html
>>
>>  if you do a lot of web programming, mod_perl is worthwhile learning, you
>> can do a lot of cool things with it.  Basically all the httpd2 internals are
>> exposed to mod_perl.
>>
>>  -jmz
>>
>> On Thu, Aug 21, 2008 at 12:37 AM, Bryan O'Neal <
>> BONeal at cornerstonehome.com <mailto:BONeal at cornerstonehome.com>> wrote:
>>
>>    Using Apache2.  Rewriting mod_proxy was suggested to me, but I am
>>    not very good with that so I am still thinking, if I have to go that
>>    deep, I should perhaps just write a servlet filter for my app and
>>    have it set as part of the config file I use for deployment.
>>
>>
>>  ------------------------------------------------------------------------
>>    *From:* plug-discuss-bounces at lists.plug.phoenix.az.us
>>    <mailto:plug-discuss-bounces at lists.plug.phoenix.az.us>
>>    [mailto:plug-discuss-bounces at lists.plug.phoenix.az.us
>>    <mailto:plug-discuss-bounces at lists.plug.phoenix.az.us>] *On Behalf
>>    Of *Joshua Zeidner
>>    *Sent:* Wednesday, August 20, 2008 9:24 PM
>>
>>    *To:* Main PLUG discussion list
>>    *Subject:* Re: Help with apache mod_rewrite
>>
>>
>>      Bryan, you may have to write a custom handler in mod_perl.  Being
>>    that you are intercepting Tomcat requests, you may have to specify
>>    what phase you want to modify.  btw- are you using httpd 1 or 2?  -jmz
>>
>>    On Wed, Aug 20, 2008 at 1:09 AM, Bryan O'Neal      <
>> BONeal at cornerstonehome.com <mailto:BONeal at cornerstonehome.com>> wrote:
>>
>>        Ok, I lied the whole thing is mute because I can not get
>>        anything work
>>        with tomcat.
>>
>>        Here is the full deal, I have my developers working on there
>>        projects
>>        with all the images being stored under
>>        /AppDir/Images/Page/image1.jpg
>>        and with our set up of apache forwarding the request through an
>>        encrypted ajp tunnel to tomcat that then forwards the image to
>>        apache,
>>        which then delivers it to the user, it is just a bit slow and
>>        there is
>>        no need for it.  What I want to do is rewrite it so instead of
>>        going to
>>        /AppDir/Images/Page/image1.jpg on my tomcat server it just goes to
>>        /Images/Page/image1.jpg on my apache server.  Any suggestions?
>>
>>        -----Original Message-----
>>
>>        For reasons I don't want to go into, I need to rewrite all
>>        references to
>>        /dir1/dir2/ to /other_dir/ so that /dir1/dir2/file.ext goes to
>>        /other_dir/file.ext and /dir1/dir2/dir3/file.ext goes to
>>        /other_dir/dir3/file.ext and dir1/dir2/dir3/dir4/file.ext goes to
>>        /other_dir/dir3/dir4/file.ext, etc.
>>
>>        I can rewrite /dir1/dir2/file.ext to /other_dir/file.ext no
>>        problem with
>>        RewriteRule ^/dir1/dir2/(.*) /other_dir/$1 however I can not
>>        seem to get
>>        it to preserve directories.  I do not mind writing additional
>>        rules to
>>        escape the directories like RewriteRule ^/test/([^/\.]+)/(.*)
>>        /other_dir/$1/$2 but that does not seem to work.  Any suggestions?
>>
>>
>>
>>

-- 
"Never take counsel of your fears." - Andrew Jackson

- http://www.joshuazeidner.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080821/dd2a5792/attachment.htm 


More information about the PLUG-discuss mailing list