Apache Server configuration support - mod_rewrite and running scripts outside CGI-BIN

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > April 2004 > mod_rewrite and running scripts outside CGI-BIN





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author mod_rewrite and running scripts outside CGI-BIN
DesignGuy

2004-04-24, 6:33 pm

This problem is driving me nuts. I've done the usual Google search and
nothing seems to fix it:

I'm trying to run PERL scripts outside the cgi-bin directory. Also, part of
the site requires mod_rewrite. Server is RedHat, using Plesk control panel.

When running the script hello.pl from the browser it generates a 403
Forbidden error (a simple "hello" script). It runs fine from shell. When
reviewing the error_log for the domain, I see:

"Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that
RewriteRule directive is forbidden:
/home/httpd/vhosts/domain.com/httpdocs/hello.pl"

The vhost.conf for the domain contains:
<Directory /home/httpd/vhosts/domain.com/httpdocs>
php_admin_value open_basedir none
Options FollowSymLinks SymLinksIfOwnerMatch Includes
AllowOverride All
</Directory>

the .htaccess file in the /httpdocs folders contains:
Options FollowSymLinks ExecCGI Includes
AddHandler cgi-script .cgi
AddHandler server-parsed .html
RewriteEngine on
RewriteRule ^CTS([^.]+).*$ /foo/index.php?test=$1

In the .htaccess file if I remove the last two lines (RewriteEngine and
RewriteRule) and hello.pl script runs fine, but then obviously the rewrite
does not.

Any ideas?




HansH

2004-04-24, 7:33 pm

"DesignGuy" <dontbother@nowhere.com> schreef in bericht
news:DLBic.15996$cF6.641343@attbi_s04...
> I'm trying to run PERL scripts outside the cgi-bin directory. Also, part

of
> the site requires mod_rewrite. Server is RedHat, using Plesk control

panel.
> When running the script hello.pl from the browser it generates a 403
> Forbidden error (a simple "hello" script). It runs fine from shell. When
> reviewing the error_log for the domain, I see:
> "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that
> RewriteRule directive is forbidden:
> /home/httpd/vhosts/domain.com/httpdocs/hello.pl"
> The vhost.conf for the domain contains:
> <Directory /home/httpd/vhosts/domain.com/httpdocs>
> php_admin_value open_basedir none
> Options FollowSymLinks SymLinksIfOwnerMatch Includes
> AllowOverride All
> </Directory>
> the .htaccess file in the /httpdocs folders contains:
> Options FollowSymLinks ExecCGI Includes
> AddHandler cgi-script .cgi
> AddHandler server-parsed .html
> RewriteEngine on
> RewriteRule ^CTS([^.]+).*$ /foo/index.php?test=$1

For all I can tell, .htaccess makes you loose SymLinksIfOwnerMatch.
Changing to 'Options +ExecCGI' might save your day
http://httpd.apache.org/docs-2.0/mod/core.html#options

> In the .htaccess file if I remove the last two lines (RewriteEngine and
> RewriteRule) and hello.pl script runs fine, but then obviously the rewrite
> does not.

I don't like .htaccess, not to mention rewrite in there ...
Rewrite is known to cluds with other directives, like (script)alias and IIRC
some mod_mime suff; adding [PT] to the and of the RewriteRule might make a
difference.

HansH


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com