Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RewriteRule help

Status
Not open for further replies.

shifter480

Technical User
Apr 28, 2009
12
GB
Hi,

I am having some trouble using a perl cgi script to perform some desired functionality. My code is as follows:

Options ExecCGI FollowSymLinks Includes MultiViews
RewriteEngine on
RewriteRule ^/NORTH_090518(.*) /C:/Projects/441/Source/nph-xredirect.cgi/$1 \
[T=application/x-httpd-cgi,L]

In my understanding this code should run my Perl cgi script which is as follows:

#!/tinyperl
#
# CGI program used to pipe data to BestInfoReplace.exe
#

# Print a message
print 'Hello world.';

$| = 1;
print $url = $ENV{'PATH_INFO'};

open FILE, ">URLPath.txt"
or die $!;
print FILE $url;
close FILE;

system("InfoReplace.exe");

If I run this from the command line it works.

However when I run this script from my application which uses apache it seems to redirect but says the page is forbidden:

HTTP 403 Forbidden

Any help would be greatly appreciated.

Thanks,

Joe
 
Well, I'm terrible with rewriting & regular expressions. However with regard to how apache handles rewriting, I suspect that I can offer some insight into your first problem. The purpose/outcome of a successful url rewrite would be the same as if you directly type the new/desired url in the address bar of the client web browser. With that said, what happens when you type C:/Projects/441/Source/nph-xredirect.cgi/[small]whatever[/small] into your client side web browser address bar? My guess here is that the client web browser is not the same machine as the web server.
 
Agree. The destination must enable ExecCGI, else I could point my rewrite to any arbitrary URL and have it exec as a cgi!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top