Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Rewrite rule problem with cgi-bin

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

Junior Member

10+ Year Member

joined:Sept 12, 2001
posts:83
votes: 0


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

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

Administrator

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

joined:July 31, 2003
posts:12533
votes: 0


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?
10:07 pm on Feb 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 12, 2001
posts:83
votes: 0


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
11:20 pm on Feb 7, 2005 (gmt 0)

Administrator

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

joined:July 31, 2003
posts:12533
votes: 0


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]