Welcome to WebmasterWorld Guest from 107.21.183.163

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Rewrite rule problem with cgi-bin

     

dawlish

4:59 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



I am trying to use a rewrite rule in order to generate friendlier urls for script generated database content using the following

RewriteRule "^/page-([0-9]+)\.html$" /home/httpd/vhosts/site14/cgi-bin/script.pl?action=form&fid=$1

However, all that seems to be happen is the script code returned in the browser rather than the script generated content.

e.g. clicking on 123456.html does not return the appropriate record in the database formatted correctly, instead the perl code of the script is returned in the browser.

I'd very much appreciate any advice or suggestions.

Thanks

coopster

7:42 pm on Feb 7, 2005 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



What happens if you key the url in with the get query string (comment out your RewriteRule for now)? Does it parse the cgi script correctly?

dawlish

10:07 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



The script works fine when I run from a browser using the full query string rather than the rewritten url. When I run the rewritten url it just outputs actually script code rather than parsing

coopster

11:20 pm on Feb 7, 2005 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It's not parsing because you have specified a MIME-type of "html". Force the MIME-type of the target file to be the correct MIME-type for your cgi installation. For example,

RewriteRule "^/page-([0-9]+)\.html$" /home/httpd/vhosts/site14/cgi-bin/script.pl?action=form&fid=$1 [T=application/x-httpd-cgi,L]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month