Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^4: From php to perl + template solution

by Nik
on Jul 14, 2010 at 06:38 UTC ( #849442=note: print w/replies, xml ) Need Help??

in reply to Re^3: From php to perl + template solution
in thread From php to perl + template solution

Why use mod_perl and not just mod_rewrite with soemthign like this:

RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^/?(.+) /cgi-bin/$1 [L,PT]
So every incoming html page request to the web server should redirect to cgi-bin/
Isn't it more easy?

My rule although seems correct thought aint working because when a request an html page a get its output instead of redirection

Replies are listed 'Best First'.
Re^5: From php to perl + template solution
by scorpio17 (Abbot) on Jul 14, 2010 at 13:46 UTC
    oops - that was a typo. I meant "mod_rewrite", not "mod_perl".
Re^5: From php to perl + template solution
by scorpio17 (Abbot) on Jul 14, 2010 at 14:00 UTC

    I'd try something like this (untested):

    # skip rule if item is an actual file or directory # (like images or stylesheets) RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)/?$ /cgi-bin/$1 [L,QSA]

    Your script can get the $1 parameter from $ENV{PATH_INFO}, and use that to determine which template file to use, etc.

      Thank you but for soem reason no matter 2 days now every mod_rewrite rule i try it just seem to NOT work.
      Fro example i try to see if it will display the html print or redirect end every time it just display a hello i made. I dont know why.

      I do know though that .htaccess inside document root does get read because if i put random stuff in it and i try the above url it produces an internal server error

      Any clues?

        This is a Perl forum, mod_rewrite is an apache module. If as you say "every" rule you try doesn't work have you considered reading the documentation, any of the mod_rewrite tutorials which are online to try to work out what you are doing wrong?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://849442]
[Corion]: Heh - I just realized, $work management just declared "no raises for anybody this year", and I'm not even angry about that. Even though that implicitly means "raises for the people with an automatic 5% raise in their contract", which the newly-merged ...
[Corion]: ... coworkers have. But I guess I've gone more mellow since I get to relax more, and such stuff doesn't make me as angry as it used to.
[Corion]: $boss will still get to listen to my interpretation :-D
[Eily]: hey, I'm just behind Larry in SioB \o/

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2018-01-22 11:02 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (233 votes). Check out past polls.