Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

rewrite urls to modperl handler

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


perl at neondawn

Nov 2, 2008, 11:18 AM

Post #1 of 2 (386 views)
Permalink
rewrite urls to modperl handler

Hi all,

I am new to mod_perl and am having a difficult time with rewrites.
Either I am doing it the most wrong way, or it's so easy that I'm over
looking it. I have searched and found nothing that seems to relate to
what I want.

I am working on a perl based wiki, to help me learn more about how perl
works. I am looking for a way to create friendly URLs that get passed to a
mod_perl handler, without having the handler location name in the url.


For instance currently I have:
http://example.com/ex_perl_h/docName

and I want:
http://example.com/docName



From my apache config:

PerlModule ExamplePackage::WC
<Location /ex_perl_h>
SetHandler perl-script
PerlResponseHandler ExamplePackage::WC
</Location>




I have mod rewrite setup to redirect request that don't an existing
file or directory to the perl handler.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*) /ex_perl_h [L]
</IfModule>

but this doesn't work.



I think what I am looking for is a mod_perl based front controler that
would handle ALL site request for URLs that don't point to a real file
or directory.

So for http://example.com/docName docName would be passed somehow to the
mod_perl script ExamplePackage::WC , similar to
http:://example.com/wc.pl?arg=docName , but done in the mod_per style.

Thanks.

Uk1ah Smith


mpeters at plusthree

Nov 3, 2008, 5:31 AM

Post #2 of 2 (365 views)
Permalink
Re: rewrite urls to modperl handler [In reply to]

perl [at] neondawn wrote:

> I have mod rewrite setup to redirect request that don't an existing
> file or directory to the perl handler.
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^/(.*) /ex_perl_h [L]
> </IfModule>
>
> but this doesn't work.

Why do you mean by "this doesn't work". There are lots of ways for it to work incorrectly. Should we
guess? Ok, my guess is that's it's going to /ex_perl_h but not /ex_perl_h/docName. Try changing your
RewriteRule to this:

RewriteRule ^/(.*) /ex_perl_h/$1 [L]

--
Michael Peters
Plus Three, LP

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.