I installed Drupal 6 in the root directory on my hosting environment using Plesk.

Now when I try to access http://mydomain.com to complete the installation I get 403 Forbidden.
The error log displays the following error: Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/mydomain.com/httpdocs/index.php

I have the default .htaccess file and there is only the following statement regarding symlinks:
# Follow symbolic links in this directory.
Options +FollowSymLinks

I don't want to start hacking the .htaccess without having a clue so as not to break the security of the system.

Thanks

Comments

yanis’s picture

I think the problem is not Drupal specific.

I created a phpinfo(); test page and I get the same error in the log.

I added the following with no success:
Options +SymLinksIfOwnerMatch
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

PHP runs as a CGI application.

cog.rusty’s picture

Check Apache's httpd.conf and find if there is an AllowOverride directive in a <Directory ...> section which applies to your web root.

- If it is "AllowOverride None", then your .htaccess file is completely ignored.
- If it is "AllowOverride All", you should be able to set anything you want in your .htaccess file, so the included "Options +FollowSymlinks" should work.
- If it is "AllowOverride [some options]" it limits what you can set in .htaccess.
After any change, restart Apache.

If you don't have access to Apache's configuration you may need to ask your host about setting Options +FollowSymlinks.

yanis’s picture

I removed the .htaccess file and I accessed the index.php page successfully.
I compared my .htaccess with the one from the official download and they are the same.

Of course I guess it is acceptable not to have a .htaccess file.

So there must be a problem with a command in the file.

cog.rusty’s picture

It is acceptable not to have an .htaccess file,
- if Apache's configuration settings are adequate for Drupal's requirements, and
- if you don't need clean URLs and you are content with URLs like http://example.com/?q=node/15

Or, if you have access to Apache's configuration file, you could put whatever Drupal needs directly in there.

yanis’s picture

I have spotted the lines that create the problem.
When I have the following in my .htaccess I get the error, when I comment them out I don't.

rewriteengine on
RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

These lines are in the official release, so would it be safe to remove them?

cog.rusty’s picture

These line are what makes clean URLs work (without ?q=). You can safely remove them if you have clean URLs disabled in Drupal's admin/settings/clean-urls page.

pilotget’s picture

I know this is an old thread, but maybe this will help other people:

I had the identical error message as you had when trying to execute some legacy perl scripts in my cgi-bin directory. After some digging around, I found out the following was missing from my configuration file.

<Directory "/var/www/mywebsite/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +FollowSymLinks
        Order allow,deny
        Allow from all
</Directory>

I had to add this for precisely the directory where I wanted to execute a file, not the parent directory. I think the apache error message was misleading, since my guess was this probably had something to do with the +ExecCGI as well.

icc97’s picture

I found a similar solution on the Parallels Forum: Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies...

The error there displays for index.pl because there is a perl Files directive override which explicitly sets all the Options, rather than adding / subtracting them.

i.e. in the main apache config it has the following:

<Files ~ (\.pl$)>
	...
	Options ExecCGI
	...
</Files>

So it over-writes any attempt to set Options FollowSymLinks.

Thus the following fixed it for me (in my vhost.conf file):

<Directory /var/www/vhosts/mydomain.com/httpdocs>
	<Files ~ (\.pl$)>
		Options +FollowSymLinks
	</Files>
</Directory>

Note that its perl files here. As the error here is for PHP files, there might be a similar setting for PHP files going on.

If not - look through the main apache config file, for anything setting the Options directive explicitly (without +/-) as this will probably be the problem.

Budrick’s picture

I`ve just commented these two lines in .htaccess in files directory:
# Options None
# Options +FollowSymLinks