Options FollowSymLinks or SymLinksIfOwnerMatch is off

72,133

Solution 1

Watch that the directory where your web application is living, is not included in another parent directory which has restricted FollowSymLinks.

The solution is to enable FollowSymLinks at the top directory (parent directory) or move your web application to a directory outside of the scope of the "no FollowSymLinks" in parent directory.

For example, the next apache config could be a problem and surely it reproduces the problem:

    <VirtualHost *:80>
      ...  
      <Directory "D:/">
        Options Indexes
      </Directory>

      <Directory "D:/mywebfolder/">
        Options Indexes FollowSymLinks
      </Directory>
      ...
   </VirtualHost>

To avoid this problem:

    <VirtualHost *:80>
      ...  
      <Directory "D:/">
        Options Indexes FollowSymLinks
      </Directory>
      ...
      ...
   </VirtualHost>

Or move your D:/mywebfolder/ to another unit e.g. E:/mywebfolder

Solution 2

I had this issue and finally found that because I had php configured with fast-cgi rather than as an apache module, I had to update the \conf\extra\httpd-fcgid.conf and then added FollowSymLinksto this block

<Files ~ "\.php$">
Options ExecCGI FollowSymLinks
AddHandler fcgid-script .php
FcgidWrapper "d:/php/php-cgi.exe" .php
</Files>

Hope this helps someone and saves the hours I wasted.

Solution 3

Note this from the apache docs for option:

Mixing Options with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort.

You are mixing options with +/- and without in your block (i.e. see FollowSymLinks).

I had this same exact error showing up today on one of my sites where I had forgotten to add a "+" in front of an option. I added the "+" and it now works.

Solution 4

I recently had a similar error and I fixed it for me. One possible root cause for this problem is that the target folder (to which the rewrite is made), mentioned in the error text itself, does not have FollowSymLinks option set. From your error message, I see this folder is: /var/www/vhosts/site.com/httpdocs/cgi-bin/

In this case, you can use in .htaccess of that specific folder:

Options +FollowSymLinks

This setting above will just add the FollowSymLinks for this folder on top of the existing options (that's what + stands for. it only adds this option).

Example:

<IfModule mod_rewrite.c>
  RewriteEngine On
  Options +FollowSymLinks
</IfModule>

This was the case where I had the error and this was how I fixed it. In my case, there was a different folder (not cgi-bin) and different file (a PHP file).

Warning:

  • Make sure you really want to rewrite URL to point to cgi-bin. If you have important scripts here, it may impact security and you may not want this rewrite to happen. If you make this setting in cgi-bin, people would be able to view output of your scripts in cgi-bin, which might not be good unless you know what you are doing.

Notes:

  • Please note that depending on local settings / browser settings, updating the .htaccess may not provide the effect in the browser instantly, when you type in the URL, and may display the same result right away, without considering your modifications to .htaccess. In this case you might have to restart the browser to see the effect of your modifications. For beginners this can be very time consuming when trying to fix, and confusing on why it won't work. Also, if you modify httpd.conf (not the case in my post), you have to restart the web server.

  • While investigating for fix to my error, I noticed on web that this error has also hapened for some people, for a Plesk installation, in which case the solution to that specific problem was to edit /etc/apache2/mods-enabled/dir.conf, and update DirectoryIndex, and move index.php before index.pl.

Share:
72,133
Admin
Author by

Admin

Updated on February 08, 2020

Comments

  • Admin
    Admin over 4 years

    I've read almost everything possible for this issue and couldn't find anything that would solve my problem. This is erorr log I'm getting: Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/site.com/httpdocs/cgi-bin/cron.pl

    When accessing site I get 403 Forbidden "You do not have permission to access this document." error.

    I've modified my .htaccess to have this:

    Options +FollowSymLinks +SymLinksIfOwnerMatch
    AddDefaultCharset utf-8
    RewriteEngine on
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule ^(.*) - [E=HTTP_CGI_AUTHORIZATION:%1]
    .
    .
    .
    

    I also added this to httpd.conf:

    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    
    <Directory />
    Options -ExecCGI FollowSymLinks -Includes -IncludesNOEXEC -Indexes -MultiViews -SymLinksIfOwnerMatch
    AllowOverride All
    </Directory>
    

    Really what can I do next?