Forum Moderators: phranque

Message Too Old, No Replies

RewriteEngine On makes CGI script forbidden

         

Splicer

10:35 pm on Jun 11, 2004 (gmt 0)

10+ Year Member



in my .htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule testing\.html /index.html

...when I point my browser to testing.html, it works great. I get the index page. Unfortunately, when I try to access [example.com...] I get a 403 Forbidden error and the error_log file gives me this:

[Fri Jun 11 13:59:43 2004] [error] [client 68.***.152.40] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/httpd/vhosts/example.com/httpdocs/test.cgi

When I change RewriteEngine to 'off' testing.html returns a 404 but test.cgi runs.

Apache/2.0.49 on Fedora Core 1. This is a virtual host (I control the whole machine, but I'm only breaking one domain at a time) and ironically I was not able to get scripts to run in the /cgi-bin/ directory. The error returned was that the script was not inside the document root. I've got mod_perl and am using suexec. If any of that makes you cringe and say "of course it doesn't work!" let me know, please. I'm cracking my skull on this particular brick wall and I appreciate any light you might shine on my predicament.

plus one silly question. What's the difference between

Options +FollowSymLinks

and

Options FollowSymLinks

? It doesn't seem to make any difference.

Thanks in advance!

[edited by: jdMorgan at 10:40 pm (utc) on June 11, 2004]
[edit reason] Removed specifics per TOS [/edit]

jdMorgan

10:51 pm on Jun 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Splicer,

Welcome to WebmasterWorld [webmasterworld.com]!

Please do not post specific/personal URLs, IP addresses, or search terms on WebmasterWorld.

Using Options +FollowSymLinks adds that option to those already in force (from httpd.conf, for example). Using Options FollowSymLinks will reset all other options, and enable only FollowSymLinks. Using plus or minus allows you to add or subtract individual options while leaving the others unchanged.

We don't know the relationship between the URLs you are using and the directories they map to on your server. However, whatever directory your cgi is in appears to be subject to the .htaccess file as far as RewriteEngine on goes, but may have Options disabled in it, again perhaps in httpd.conf.

Your best bet may be to go into httpd.conf, set Options All and AllowOverride All, and then work backwards from there, diabling the Overrides and Options you wish to restrict until the code breaks again.

See the Apache core documentation [httpd.apache.org] for details on Options and AllowOverride directives.

Jim

Splicer

11:49 pm on Jun 11, 2004 (gmt 0)

10+ Year Member



Thanks, and sorry for the indiscreet identifiers.

After doing what you suggested in all the relevant documents (httpd.conf, httpd.include, and the httpd.include for the vhost), everything seems to work. Now I'll go back and see what needs to be shut down. Looks like I've got a lot of digging ahead of me.

But I get to go home for the weekend after having made some small amount of progress instead of having the zombified stare of a man who accomplished nothing this week. You've taken a tremendous burden off my shoulders!