Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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/index.py?page=$1 [L,PT]
So every incoming html page request to the web server should redirect to cgi-bin/index.py
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


Comment on Re^4: From php to perl + template solution
Download Code
Re^5: From php to perl + template solution
by scorpio17 (Monsignor) 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 (Monsignor) 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/index.pl/$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 http://webville.gr/index.html 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://849442]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-12-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (181 votes), past polls